如何使用rCharts在highcharts中动态向序列添加点
我试图在如何使用rCharts在highcharts中动态向序列添加点,r,highcharts,rcharts,R,Highcharts,Rcharts,我试图在rCharts包中动态添加一个带有highcharts的数据点。我的问题是我不能得到额外的点来绘图。我没有收到错误消息。我的数据正在从Google Analytics实时API调用 我的代码是 #My initial plot here works fine a <- hPlot(active.users ~ timestamp, data = realDataFrame, type = 'spline', title = 'SBK Users per
rCharts
包中动态添加一个带有highcharts
的数据点。我的问题是我不能得到额外的点来绘图。我没有收到错误消息。我的数据正在从Google Analytics实时API调用
我的代码是
#My initial plot here works fine
a <- hPlot(active.users ~ timestamp, data = realDataFrame,
type = 'spline', title = 'SBK Users per Minute', subtitle = 'Real-Time')
a$global(useUTC = TRUE)
a$xAxis(type='datetime',labels = list(format = '{value:%H:%M}'))
a$yAxis(floor = 0, gridLineColor = '#ffffff')
a
# Attempt to add point with while loop
while(TRUE){
Sys.sleep(3)
print(realDataAdd <- get_realtime(id, metrics = 'rt:activeUsers',
filters = 'rt:pagePath=@www.mybiz.com/url/'))
print(timestamp <-as.numeric(Sys.time())*1000)
print(realDataAdd <- cbind(realDataAdd, timestamp))
print(realDataAdd <- as.vector(realDataAdd, mode = 'numeric' ))
print(a$series(addPoint = realDataAdd ,list(redraw = TRUE, shift = FALSE)))
}
#我在这里的初始绘图效果良好
A.