rCharts - 以x轴为单位的日期

时间:2017-06-27 11:43:17

标签: r highcharts rcharts

我正在尝试使用rCharts库绘制图形。问题是在x轴而不是日期,时间戳即将来临。

我的数据框是:

enter image description here

代码是:

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)

最后,我的图表如下所示。正如你所看到的,而不是日期时间戳即将到来

enter image description here

更新:使用as.Date()和put(type =&#39; datetime&#39;)将userLoadData $ timestamp转换为日期

0 个答案:

没有答案