我在rails中使用chartkick来生成这样的图表:
<% @graphs.each_with_index do |g, i| %>
<%= column_chart g, discrete: true, min: 0.0, max: 1.1, colors: ["pink", "blue", "red"],
library: {hAxis: {textStyle: {fontSize: 10}}} %>
<% end %>
其中 g 是一些数据,例如:
[['test1', 0.1],['test2',0.4],['test3',07]]
我的问题是,前三列不是粉红色、蓝色和红色,而是全是粉红色!
有谁知道如何使酒吧的颜色不同?
编辑:
玩具示例:
<%= column_chart [['test1', 20], ['test2', 30],['test3', 30]], colors: ["pink", "red", "blue"] %>