rCharts : Highcharts column with color based on value

前端 未结 2 2012
孤街浪徒
孤街浪徒 2021-01-27 20:14

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(da         


        
相关标签:
2条回答
  • 2021-01-27 20:39

    Try to use colorByPointer parameter

    0 讨论(0)
  • 2021-01-27 20:40

    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

    0 讨论(0)
提交回复
热议问题