【发布时间】:2014-09-03 01:45:16
【问题描述】:
我在 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"] %>
【问题讨论】:
标签: ruby-on-rails google-visualization chartkick