如何在 R 中获取正确的 highcharts 日期时间格式(使用 rcharts)

How to get the correct the date-time format for highcharts in R (using rcharts)

我目前有一个名为 minuteDataPlot 的数据框,我试图在其中使用 rCharts 中的 highcharts 进行绘图

users      timestamp
1276   2015-10-03 09:00:00
1292   2015-10-03 09:01:00
1306   2014-10-03 09:02:00

这是我的代码:

a <- hPlot(users ~ timestamp, data = minuteDataPlot,
           type = 'spline', title = 'SBK Users per Minute', subtitle = 'Real-Time')
a$global(useUTC = FALSE)
a$xAxis(type='datetime')
a

minuteDataPlot$timestamp 的 class 是 POSIXlt。我的结果是

您可以看到 x 轴没有反映我的时间戳数据。我希望得到与我的时间戳类似的东西(例如 2015-10-03 09:00:00)。

我也尝试过使用数字 class,但我得到了相同的结果。任何帮助都会很棒。我当然也检查了 highcharts 文档,但我似乎在那里找不到任何帮助。

我明白了,现在你必须转换为毫秒。这是对我有用的代码:

minuteDataPlot2 <- transform(minuteDataPlot,
timestamp2 = as.numeric(as.POSIXct(timestamp))*1000)