rcharts highcharts plotLines

懵懂的女人 提交于 2019-12-12 02:57:53

问题


I am having a little trouble to draw a horizontal line by using rcharts (highcharts) on a plot. I would like to use the plotLines from highcharts library to do this. Below is my code:

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

Without the plotLines, my chart display with no problem. Once i added in the plotLines, it is not working. I am not sure if rcharts support plotLines in highcharts?

Appreciate if any experts here can give advice. Thanks!


回答1:


Hello look at this example :

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

It's missing a list() in your plotLines argument, it needs two list.



来源:https://stackoverflow.com/questions/30703979/rcharts-highcharts-plotlines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!