Google Chart Gem
Written by matt on December 9th, 2007
update Nov 11: the gem is finally available there or simply:
sudo gem install googlecharts |
Note that I'm working on merging this gem with another Google Charts gem. (see comments for more info about that)
I've been working on a Google Chart Gem that I have ready for a beta release but unfortunately, getting a new project setup on RubyForge takes forever. (apparently 72 hours)
It's mainly a wrapper for the great GChart API, but instead of using a helper to generate your graphs, you can simply do:
1 2 3 4 5 6 7 8 |
Gchart.bar(:title => 'My Mojo', :data => [1,2,4,67,100,41,234], :max_value => 300, :bg => 'c3c3c3') Gchart.line(:title => 'My Mojo', :data => [[1,2,4,67,100,41,234],[41,63,96,17,100,14,423]], :bg => '666666', :graph_bg => 'cccccc', :line_colors => 'ff0000,00ff00', :legend => ['morning','evening']) |
1 2 3 |
Gchart.pie(:data => [20,10,15,5,50], :title => 'SDRuby fu', :size => '400x200', :labels => ['matt', 'rob', 'patrick', 'jordan', 'ryan']) . |
As far as I know this is most complete Ruby wrapper for Google Chart API, but feel free to look around.
Comments
-
Way to go! Looking forward to using this.
-
Looks like you beat me to the gem release :-). I just started a project on Google Code at http://code.google.com/p/gchartb for a Ruby wrapper around the Google code API.
Deepak
-
Sorry, wrong link "http://code.google.com/p/gchartrb/":http://code.google.com/p/gchartrb/
-
Awesome - going to check this out as soon as I can.
Hopefully it can replace some SWF charts that take a little bit longer then I like to load :( - .... oh and Google's API being "free" helps as well ;)
-
Can't wait for this beta release!!!!!! :)
I took a look at the API yesterday, and today I see your post! :P
You're too fast guy! ^^
It seems to be a nice work!
-
Great! Can't wait to use it. Installed the gem but get the error below in my Rails app when I cut-pasted your sample code above into a view.
uninitialized constant ActionView::Base::CompiledTemplates::Gchart
What did I miss?
Rich
-
After discussing with John Barnette author of another Gchart gem, we decided to merge our projects: http://rubyforge.org/projects/gchart/ http://gchart.rubyforge.org/gchart/
Most of the new features should be deployed sometimes tonight :)
-
LOL.
That was my problem. I was using John's gem with Matt's documentation.
Looking forward to ONE gem (with matching documentation). :)
-
cool, that didn't take long :) thanks for your work!
-
Which one will be the site of the merged project? :)
-
Sorry about the confusion. My original gem is available "there":http://rubyforge.org/projects/googlecharts/ while the merged gem will be available "here":http://gchart.rubyforge.org/gchart/"
-
This is great! Cheers mate.


