0

我在 rails 3 中使用 LazyHighCharts。我的要求是在一列中显示不同的颜色。当我使用 series = { :type=> 'bar', :name=> [], :data=> @rooms, :color=> 'pink' } 它以粉红色显示整列。假设我在一列中有 5 行,我想以粉红色显示第一行,其余四行以绿色显示。谁能建议我解决这个问题。谢谢

4

1 回答 1

0

i don't know if you have resolved this issue, but this is how i resolved it.

#Controller before set data to the series option
data = []
your_array.each do |t|
       data << {:y=>t.value, :color=>"#"+("%06x" % (rand * 0xffffff))}
end

then set data to series option
f.series({:name=>"Subcurso", :data=>data} )
于 2013-04-04T21:38:51.480 回答