mattetti / googlecharts

Ruby Google Chart API
http://mattetti.github.com/googlecharts/
MIT License
699 stars 108 forks source link

Legend labels are not parsed correctly #18

Closed lukeredpath closed 14 years ago

lukeredpath commented 14 years ago

When generating a sparkline or line graph (this may also happen with other types but not tested), parsing an array of legend labels doesn't work properly:

Gchart.sparkline(..., :legend => %w{foo bar baz})

This generates a URL that contains the following string:

chdl=foo%124bar%124baz

Passing in a single-element array containing a pipe-delimited string seems to work as expected:

Gchart.sparkline(..., :legend => %w{foo|bar|baz})

Produces:

chdl=foo%7Cbar%7Cbaz

Passing in just a pipe-delimited string fails too; it needs to be a single-element array.

mattetti commented 14 years ago

$ irb

require 'lib/gchart' => true Gchart.sparkline(:legend => %w{foo bar baz}) => "http://chart.apis.google.com/chart?chdl=foo|bar|baz&cht=ls&chs=300x200&chxr=0"

Are you sure you're on the latest version? 1.5.3

mattetti commented 14 years ago

I also tried the gem:

$ irb
>> require 'googlecharts'
=> true
>> Gchart.sparkline(:legend => %w{foo bar baz})
=> "http://chart.apis.google.com/chart?chdl=foo|bar|baz&cht=ls&chs=300x200&chxr=0"
lukeredpath commented 14 years ago

As I mentioned on Twitter, I can confirm this is fixed in 1.5.3; I'm using bundled gems and hadn't reloaded Passenger so it was still picking up the old gem when I tried this (despite doing a bundle install). My bad.

mattetti commented 14 years ago

No worries, thanks for the report tho, much appreciated.