winston / google_visualr

A Ruby Gem for the Google Visualization API. Write Ruby code. Generate Javascript. Display a Google Chart.

Home Page:http://googlevisualr.heroku.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Name error while using GoogleVisualr::Image::PieChart

jaguarviajero opened this issue · comments

Hello,

I'm trying to use GoogleVisualr::Image::PieChart to render an image which will then be rended in PDF by wicked_pdf.

I'm succesfully using GoogleVisualr::Interactive::PieChart in my code for HTML output, however, when I use the Image::PieChart I get this error:

uninitialized constant GoogleVisualr::Image::PieChart

Here is the output I get from the rails console:

Loading development environment (Rails 3.2.2)
irb(main):001:0> GoogleVisualr::DataTable.new
=> #<GoogleVisualr::DataTable:0x00000003af5070 @cols=[], @rows=[]>
irb(main):002:0> GoogleVisualr::Image::PieChart
NameError: uninitialized constant GoogleVisualr::Image::PieChart
    from (irb):2
    from /var/lib/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
    from /var/lib/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
    from /var/lib/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
irb(main):003:0> GoogleVisualr::Interactive::PieChart
=> GoogleVisualr::Interactive::PieChart

I'm using Rails 3.2.2 and google_visualr 2.1.1

Any help to be able to render an image instead of an interactive chart is welcome.

Based on the GoogleVisualr API, the only non-interactive chart that is available is "Spark Line". (see http://googlevisualr.herokuapp.com/). See also #43

Does the interactive PieChart render correctly in the PDF?

You could also try using https://github.com/mattetti/googlecharts just for the PDF....

I didn't ready the docs thoroughly enough...

No, the interactive PieChart does not render in PDF; that is what prompted me to try the Image::PieChart.

Is this still a problem?

Actually, the Image::PieChart is still included in the GoogleVisualr gem despite the deprecation warnings from Google.

I have not started work on removing it from the gem. But, you might want to upgrade to the latest version of the gem, just to make sure that it's not an outdated version that's causing problem for you.

Also' there's an undocumented method #uri for images that might be useful for you. Check out #26.

Closing this for now because it doesn't seem to be a problem with the gem.