0

I am trying to plot a graph using rCharts library.Problem is on x-axis instead of date, timestamp is coming.

My data frame is:

enter image description here

Code is:

h <- getChart(chartType)
lineWidth <- 2
colors <- c('#2F9BE4', '#349A34', '#B44545')
h$title(text = "OnlineUsers and Load Average")
h$xAxis(categories = userLoadData$timestamp)
h$yAxis(title = list(text = 'Numbers'), opposite = FALSE)
h$series(data = userLoadData$viewingVideos, name="Students watching Video", lineWidth=lineWidth, color=colors[[1]], marker=list(radius = 0), zoneAxis = 'x', zones=list(c(value = last),  c(dashStyle = "dot")))
return (h)

Finally, my chart looks as follows. As you can see instead of date timestamp is coming there

enter image description here

Update: Converting userLoadData$timestamp to date using as.Date() and putting (type = 'datetime') worked

ktrev
  • 37
  • 3
  • 9

0 Answers0