我正尝试在Grail中使用GCHART gem添加Google条形图。这是我在控制器中所做的。此代码可以成功显示条形图。但是,没有工具提示显示。如何显示一些工具提示?
@months = Array.new
@sells_per_month = Array.new
@sells_months = Order.all.to_a
@om = @sells_months.group_by {|t| t.created_at.beginning_of_month }
@om.each do |month, orders|
@months.push(month.strftime('%b, %y'))
@sells = 0
for order in orders
@sells = @sells + order.total_price
end
@sells_per_month.push(@sells)
end
@sells_per_month_max = @sells_per_month.max
@sell_chart = Gchart.bar(
:size => '640x321',
:bar_colors => ["882244"],
:title => "Orders per users",
:bg => 'EFEFEF',
:data => [@sells_per_month],
:bar_width_and_spacing => {:width => 55},
:axis_with_labels => ['x', 'y'],
:axis_labels => [Array(@months)],
:axis_range => [nil, [0,@sells_per_month_max,@sells_per_month_max/10]]
)