如何在Rails中的谷歌图表(Gchart Gem)中显示工具提示

时间:2019-01-22 06:50:35

标签: ruby-on-rails tooltip gchart

我正尝试在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]]
  )

0 个答案:

没有答案