问题描述
在绘图上使用rcharts(highcharts)绘制水平线时有点麻烦。我想用highcharts库中的plotLines来做到这一点。下面是我的代码:
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))
没有plotLines,我的图表显示没有问题。一旦我加入plotline,它不起作用。我不确定rcharts是否支持高线图中的plotline?
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!
推荐答案
你好,看看这个例子:
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
缺少a list()
在 plotLines
参数中,它需要两个 list
。
It's missing a list()
in your plotLines
argument, it needs two list
.
这篇关于rcharts highcharts plotLines的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!