jeremyolliver / gvis

Rails plugin for easy embedding charts with Google Visualization API
http://github.com/jeremyolliver/gvis
MIT License
49 stars 22 forks source link

visualization arguments accepting a string not working? #5

Closed schustenberg closed 12 years ago

schustenberg commented 14 years ago

Hi, I see an issue with the following code: ... <% visualization "chart_id2", "LineChart", :width => 600, :height => 400, :pointSize => 8, :title => "test", :html => {:class => "graph_class"} do |chart| %> ...

it does not display the chart. If I remove the :title => "test" option in the visualization function call it works fine. Same issue if I try any other option expecting a string as argument (i.e. titleX, titleY, legend...). Am I doing something wrong? thanks

GaetanD commented 14 years ago

you need to use javascript literals as arguments:

not very intuitive, maybe we should write something to automatically convert ruby strings in javascript strings as it has been done for ruby dates in DataTable#js_format_data

jeremyolliver commented 13 years ago

Whoops, missed seeing this comment earlier. Yes, I agree GaetanD, it would be much nicer to handle this internally in the library. If I get some time, I might write a patch for this, but in the meantime, if anyone else feels like doing so, go right ahead, I've already accepted a number of pull requests in.

jeremyolliver commented 12 years ago

To summarize: :width => 600 doesn't work :width => '600px' is what should be used here. I'm going to close this, as this this doesn't seem high priority and there could be a significant amount of cases to catch as there could be any number of options that should be specified as a number of pixels.