Every repository with this icon (
Every repository with this icon (
| Description: | Sexy Charts using Google API & Ruby edit |
-
Gchart.line(:label_axis => 'x,y,r') documentation error
1 comment Created 7 months ago by kanweishould be Gchart.line(:axis_with_labels => 'x,y,r')
Comments
-
I found this bug when adding an ampersand to a legend string.
Perhaps you as the maintainer can fix this issue withCGI.escape. I tried to integrate it, but I'm not exactly sure where to substitute. The methodGChart.jstizeis the wrong place because of already applied parameter concatenation.GChart#query_builderseems to be a better place ...If you have no time to fix it by yourself or accept a hackish version, please drop me a note. Then I would try my best.
Thanks,
der_floComments
The best thing would be to write a quick failing spec to show what the problem is, I would be glad to fix it if I can easily reproduce the problem.
Thanks,
- Matt
Here you have a quick (failing) spec addition:
http://gist.github.com/99988Here you have a somewhat hackish patch for legends:
http://github.com/der-flo/googlecharts/commit/8004aeb6999cf9bcc40bfe38b42e0feaebeacee1
It should be applied in more places, perhaps you have a good idea.Thanks and bye,
der_flo -
I'm trying to draw a vertical bar graph with a manually-labelled x-axis and an automatically labelled y-axis. This is possible, and here is the correct url:
http://chart.apis.google.com/chart?chs=300x200&chxr=0,0,5&chxt=y,x&chd=s:AM9&cht=bvs&chxl=1:%7Cfoo%7Cbar%7Cqux
Gcharts does not seem to allow this, however. Here's the closest I can get:
does not display y-axis labels:
chart = Gchart.bar(:data => [0, 1, 5], :axis_with_labels => 'x', :axis_labels => [['foo', 'bar', 'qux']]) # => http://chart.apis.google.com/chart?chs=300x200&chxr=0,0,5&chxt=x&chd=s:AM9&cht=bvs&chxl=0:%7Cfoo%7Cbar%7Cquxincorrect y-axis range:
chart = Gchart.bar(:data => [0, 1, 5], :axis_with_labels => 'x,y', :axis_labels => [['foo', 'bar', 'qux']]) # => http://chart.apis.google.com/chart?chs=300x200&chxr=0,0,5&chxt=x,y&chd=s:AM9&cht=bvs&chxl=0:%7Cfoo%7Cbar%7Cquxdoes not display y-axis labels:
chart = Gchart.bar(:data => [0, 1, 5], :axis_with_labels => 'y,x', :axis_labels => [nil, ['foo', 'bar', 'qux']]) # => http://chart.apis.google.com/chart?chs=300x200&chxr=0,0,5&chxt=y,x&chd=s:AM9&cht=bvs&chxl=0:%7C%7C1:%7Cfoo%7Cbar%7CquxSo maybe axis_labels should optionally take a Hash, so I can specify the labels for axis 1 without it inserting a blank label list for axis 0?
Also, maybe Gchart#full_data_range should pay attention to axis ordering from :axis_with_labels. It currently inserts the axis_range for axis 0, even if they have been swapped.
Comments
The Hash method is implemented http://github.com/ghazel/googlecharts/tree
I chose to leave axis_with_labels alone, since the API likes to leave data and axis separate. -
C:\Ruby\lib\ruby\gems\1.8\gems\mattetti-googlecharts-1.4.0>spec spec\gchart_spec.rb ....F................................................................................... 1) Errno::ENOENT in 'generating a default Gchart should use theme defaults if theme is set' No such file or directory - ./spec/fixtures/test_theme.yml ./spec/../lib/gchart/theme.rb:29:in `initialize' ./spec/../lib/gchart/theme.rb:29:in `open' ./spec/../lib/gchart/theme.rb:29:in `initialize' ./spec/../lib/gchart/theme.rb:29:in `each' ./spec/../lib/gchart/theme.rb:29:in `initialize' ./spec/../lib/gchart/theme.rb:15:in `new' ./spec/../lib/gchart/theme.rb:15:in `load' ./spec/../lib/gchart.rb:28:in `method_missing' ./spec\gchart_spec.rb:32: Finished in 0.487 seconds 88 examples, 1 failure C:\Ruby\lib\ruby\gems\1.8\gems\mattetti-googlecharts-1.4.0>dir spec\fixtures Volume in drive C has no label. Volume Serial Number is 8847-D2CE Directory of C:\Ruby\lib\ruby\gems\1.8\gems\mattetti-googlecharts-1.4.0\spec File Not Found
Comments
This is fixed in http://github.com/ghazel/googlecharts/tree
-
set_range_markers doesn't include support for lines
0 comments Created 3 months ago by ghazelLine styles use chm= for shape markers:
http://code.google.com/apis/chart/styles.html#line_styles
googlecharts currently only uses it for range markers, so there's no way to use it for lines.
Comments
-
This code:
convert_to_simple_value( (@@simple_chars.size - 1) * number / @max_value)Doesn't take the minimum value in to account. So if your data is [100,100.1,100.2,100.3] you will get a max_value of 100.3 and all the numbers get all 60 and 61, and not distinct data points.
The same problem exists for 'extended' range types.
Comments
This is fixed in http://github.com/ghazel/googlecharts/tree
-
This code:
@min = (min_ds_value < 0) ? min_ds_value : 0always gets a minimum of 0 for positive values, which I believe is the opposite of what was intended.
For example, with data of [100,200,300] the range calculated by full_data_range would be [0,300] instead of [100,300].
Then again, I don't see why any positive or negative check exists. Negative and positive minimums seem to work fine:
http://chart.apis.google.com/chart?chs=320x200&cht=bvs&chd=t:30,-60,50,120,80,-90&chds=-80,140&chxt=y&chxr=0,-80,140
Comments
This is fixed in http://github.com/ghazel/googlecharts/tree
-
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x', :axis_labels => ['Jan','July','Jan','July','Jan'])
Returns:
"http://chart.apis.google.com/chart?cht=lc&chs=300x200&chxl=0:%7CJan%7C1:%7CJuly%7C2:%7CJan%7C3:%7CJuly%7C4:%7CJan&chd=s:9UGoUo9C&chxt=x"Notice the axis labels:
chxl=0:%7CJan%7C1:%7CJuly%7C2:%7CJan%7C3:%7CJuly%7C4:%7CJanThis doesn't doesn't create proper labels.
Comments
-
On my 1.9.1, charts URLs aren't getting built at all.
The offending code seems to be:
def query_builder(options="")
dataset query_params = instance_variables.sort.map do |var| case var when '@data'"case var" needs to be "case var.to_s" under Ruby 1.9.1; the case equality isn't working with a symbol.
Comments
-
Found out that PNGs do not write correctly to file on windows, at least not on vista. Solution is to change file open flags to "wb+" in method write(), as follows:
def write(io_or_file=@@file_name) return io_or_file.write(fetch) if io_or_file.respond_to?(:write) open(io_or_file, "wb+") { |io| io.write(fetch) } endthanks to the clear explanation of why the PNG header is like it is on wikipedia.
Cheers,
VictorComments












a patch would be super appreciated ;)