How to change the color of a Column-chart created with Chartkick?

╄→гoц情女王★ 提交于 2019-12-23 12:53:50

问题


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?


回答1:


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




回答2:


I think it might work like this:

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

Like this you can define that for each series.



来源:https://stackoverflow.com/questions/22179365/how-to-change-the-color-of-a-column-chart-created-with-chartkick

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