rCharts : Highcharts column with color based on value

女生的网名这么多〃 提交于 2021-02-05 10:46:05

问题


I'm trying to plot efficiency in column plot with highchart.

data <- c(25,50,75,100)
a <- rCharts:::Highcharts$new()
a$chart(type = "column")
a$data(data)
a

normal rchart highchart plot

is it possible,using rcharts to obtain below chart required plot


回答1:


Try to use colorByPointer parameter




回答2:


This will change the color of each column in your series. Obviously, you can choose whichever color you want.

values <- c(25,50,75,100)
vcolor <- c("orange", "green", "blue", "red")

a <- rCharts:::Highcharts$new()
a$chart(type = "column")
a$series(data = list(
  list(y = values[1], color = vcolor[1]),
  list(y = values[2], color = vcolor[2]),
  list(y = values[3], color = vcolor[3]),
  list(y = values[4], color = vcolor[4])
), name = 'Data')
a

Carlos



来源:https://stackoverflow.com/questions/27284929/rcharts-highcharts-column-with-color-based-on-value

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