rcharts highcharts 绘图线

rcharts highcharts plotLines

我在绘图上使用 rcharts (highcharts) 绘制水平线时遇到了一些麻烦。我想使用 highcharts 库中的 plotLines 来做到这一点。下面是我的代码:

a$yAxis(title='my_Yaxis name', plotLines=list(color='red', value=10, width=2))   

没有 plotLines,我的图表显示没有问题。一旦我添加了 plotLines,它就不起作用了。我不确定 rcharts 是否支持 highcharts 中的 plotLines?

请高手指教。谢谢!

你好,看看这个例子:

library("rCharts")
# Some data
x <- abs(rnorm(10))
# A graph with column
h <- Highcharts$new()
h$chart(type = "column")
h$series(data = x)
h$xAxis(categories = letters[1:10])
# the horizontal line
h$yAxis(title = list(text = "rnorm()"),
        plotLines = list(list(
          value = mean(x),
          color = '#ff0000',
          width = 3,
          zIndex = 4,
          label = list(text = "mean",
                       style = list( color = '#ff0000', fontWeight = 'bold' )
          ))))
h

你的 plotLines 参数中缺少一个 list(),它需要两个 list