rcharts和connectNulls

时间:2016-03-22 17:03:14

标签: r rcharts

我似乎无法在rcharts中使connectNulls正常工作。下面的代码应该会产生连接4月和Junes数据的绿线。相反,它只是忽略了null,就像只有11个数据点一样。

h <- Highcharts$new()
h$xAxis(categories = c('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))
h$yAxis(list(list(title = list(text = 'Rainfall'))
             , list(title = list(text = 'Temperature'), opposite = TRUE)
             , list(title = list(text = 'Sea Pressure'), opposite = TRUE))
)
h$series(name = 'Rainfall', type = 'column', color = '#4572A7',
         data = c(49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4)
         )
h$series(name = 'Temperature', type = 'spline', color = '#89A54E',
         data = c(7.0, 6.9, 9.5, 14.5, NULL, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6),
         yAxis = 1,  
         connectNulls = TRUE
         )
h$series(name = 'Sea-Level Pressure', type = 'spline', color = '#AA4643',
         data = c(1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7),
         #xAxis = 1,
         yAxis = 2,
         connectNulls = TRUE)
h

这是生成的图表: connectNulls not working

有人可以告诉我如何使其正常工作。

1 个答案:

答案 0 :(得分:0)

问题实际上是一件事。尝试:

list

不是5但是2.所以要强制考虑该元素,请尝试考虑c而不是data = list(7.0, 6.9, 9.5, 14.5, NULL, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6)

The mandatory text (CDATA) inside tag 'head > style : boilerplate' is missing or incorrect.

希望它有所帮助。

PS:只是想邀请您试试trait implementations for HashSet