views:

391

answers:

1

I'm having my first go at using Google charts using a Ruby wrapper called gchartrb. My first attempt was to draw a bar chart, which works fairly well, except that the largest value (Trend 2 - 800) hits the top of the y axis. I'm guessing this is a Google Charts issue, but I was wondering if there was a way around this problem so all values scale correctly?

labels = [1, 2, 3, 4]
GoogleChart::BarChart.new('800x200', "Bar Chart", :vertical, false) do |bc|
bc.axis :x, :labels => labels, 
            :color => '000000' # Months
      bc.axis :y, :labels => [0, 100, 200, 300, 400, 500, 600, 700, 800, 900], 
            :color => '000000' # Number of books
  bc.data "Trend 1", [100,200,300,400], '0000ff'
  bc.data "Trend 2", [500,600,700,800], 'ff0000'
   bc.width_spacing_options :bar_width => 50, :bar_spacing => 0, :group_spacing => 0
  puts "\nBar Chart"
  puts bc.to_url
end
A: 

Gave up on this gem and ended up using Google Charts directly.

John Polling