Rails 3プロジェクトで作業していますが、LazyHighChartジェムで生成する円グラフの色を変更したいのですが、その方法がわかりません。
これは私のメソッドコントローラーです
def set_pie_chart(data)
fixed_data = []
data.each_pair do |key, value|
fixed_data << [key.name, value]
end
@color = data.keys.map {|e| "#" + e.colour } # e.colour is like '333333'
@chart = LazyHighCharts::HighChart.new('pie') do |c|
c.chart({:defaultSeriesType=>"pie" , :margin=> [0, 0, 0, 0]})
series = {
type: 'pie',
name: 'total expenses',
data: fixed_data,
colors: ['green','red'] # intent
}
c.series(series)
c.colors = ['red','blue','black'] # intent
c.options[:colors] = ['green','blue','yellow'] # intent
c.options['colors'] = ['red','blue','yellow'] # intent
c.options[:title][:text] = nil
c.plot_options(:pie=>{
cursor: "pointer",
center: ['50%','37%'],
color: 'red', #intent
dataLabels: { enabled: false }
})
end
end
この方法はエラーを残しません、正しい方法は何ですか、またはこの宝石では不可能ですか?
または、他にどのような優れた代替宝石をプロジェクトに使用できますか?