mattetti/googlecharts

Legend labels are not parsed correctly

Closed this issue · 4 comments

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.

$ 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

  • Matt

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"

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.

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