mattetti/googlecharts

1.5.1 breaks axis_range

Opened this issue · 3 comments

In 1.4.0 you can do axis_range like:

 >> Gchart.line(:data => [1,3,8], :axis_with_labels => 'x', :axis_range => [[0,10,2]])
 => "http://chart.apis.google.com/chart?chxr=0,0,10,2&chxt=x&chd=s:HW9&cht=lc&chs=300x200"

In 1.5.1 you get:

>> Gchart.line(:data => [1,3,8], :axis_with_labels => 'x', :axis_range => [[0,10,2]])
=> "http://chart.apis.google.com/chart?chxt=x&chd=s:HX9&cht=lc&chs=300x200&chxr=1,8"

Here chxr is taken from the dataset instead of the specified axis_range values.

confirmed, I need to look into it, feel free to send a patch tho.

I think it is because of axis index. I made a pull request
http://github.com/mattetti/googlecharts/pull/29
Please check it :)

x37v commented

horizontal bar charts with data that is sorted in reverse gives garbage too:

    ruby-1.9.2-p0 > Gchart.bar(:data => [123,50,1], :axis_labels => [["1", "50", "123"]], :axis_with_labels => 'y', :orientation => 'horizontal')
     => "http://chart.apis.google.com/chart?chxl=0:|1|50|123&chxt=y&chd=s:9ZA&cht=bhs&chs=300x200&chxr=0,123,50,1"