【问题标题】:rcharts highcharts plotLinesrcharts highcharts plotLines
【发布时间】:2015-08-22 14:45:01
【问题描述】:

在绘图上使用 rcharts (highcharts) 绘制水平线时遇到了一些麻烦。我想使用 highcharts 库中的 plotLines 来执行此操作。以下是我的代码:

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

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

如果这里有任何专家可以提供建议,不胜感激。谢谢!

【问题讨论】:

    标签: r highcharts rcharts


    【解决方案1】:

    你好看看这个例子:

    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

    【讨论】:

    • 太棒了。现在可以了!感谢您的友好分享...祝您有美好的一天! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 2014-06-16
    • 2023-03-28
    • 2019-10-20
    • 1970-01-01
    相关资源
    最近更新 更多