Question

Is it possible to change the color of a Column-Chart created with Chartkick ? I searched for it inside the Documentation but i could not find anything about it. Any Ideas?

Was it helpful?

Solution

For Google Charts, use the library option to change the color of the entire series.

<%= column_chart data, :library => {:colors => ["red"]} %>

There's not an easy way to change each bar in a single series at the moment.

https://developers.google.com/chart/interactive/docs/gallery/columnchart

OTHER TIPS

I tried the above solutions they did not work. The color option for chartkick should be in the below format to work.

<%= column_chart @data, colors: [["#63b598", "#ce7d78", "#ea9e70", "#a48a9e", "#c6e1e8"]] %>

Result

I think it might work like this:

  = column_chart(@data, library => { :series => { 0 => { color: "red" } }

Like this you can define that for each series.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top