I showed off Gruff at the world’s most awesome Ruby group last night and stayed late to add initial bar graph support. Bar graphs don’t have lower labels yet, and I want to space the bar groups separately with a little bit of room in between.
Also fixed:
Update with
gem install gruff
To use a bar graph, start your script with
graph = Gruff::Bar.new
Justin Palmer suggested custom graphics for the actual bars in the graphs. This would be awesome and is very possible. I want to implement pie graphs first and will then look at using more custom graphics in the charts themselves.
I’ll be putting Gruff on hold for the next week, but feel free to send me patches or enhancements.
This might also be a good time to mention that I am a full time freelance Ruby and Rails consultant. I’m booked at least through Christmas, but contact me if you need custom graphics programming, database design, or general Rails work!
Hm… World’s most awesome Ruby Group? I smell a battle brewing.
http://www.flickr.com/photos/mattpelletier/sets/1218232/
It’s not only Windows that requires the title case for RMagick, I couldn’t get my Ubuntu Linux to work until I changed the require.
Fantastic libary by the way, I’ve been on the look out for a good looking graphing library and this seems to be it! :)
Correction:
It tries “require ‘rmagick’” and then catches failure and tries “require ‘RMagick’” (on any platform).
Hopefully this will fix it for most people.
Huh!
I was just writing the bar graph on the train. Now I’ll have to have a go at another one.
Others are doing pie and area.
If you want to do a standard-deviation type chart or another that strikes your fancy, go for it.
Std Dev
Yay! Thanks, Geoffrey. I’ll look into adding other types of graphs if/when I have some time. This looks really nice… additional themability (like the custom images idea) would be awesome.
Oh this is going to rock so much! My customers are going to love this. Great idea about the custom bar graphics btw.
Still doesn’t quite work with Windows. I tried fixing the rescue (its a nameError ;-) ) but that still chucks out a load of non-terminal error messages.
A cleaner (but hacky) fix is:
begin require ‘Win32API’ require ‘RMagick’ # capitalized on Windows rescue LoadError require ‘rmagick’ # not on other oses end
in base.rb
eeew! yucky formatting!
begin
rescue LoadError
end
I’ve been doing graphing recently with SVG::Graph and using RMagick to convert to PNG.
My results aren’t quite as pretty as yours, but SVG::Graph is very easy to use: http://weather.bensinclair.com/
That’s a development mode Rails app, and the graph data on there isn’t up to date. A work in progress!
Great work so far, this project looks promising. The default font setting in base made things a little wonky until I added the proper environment variable, though. Maybe have a different default if that environment variable isnt found, or on Windows use SystemRoot\Fonts?
Scott
Doh, wasnt the default font setting, ‘twas an ID10T error…. Anyway, some ideas:
Multiple series support Custom legends Custom title placement Custom aspect ratios
Another stuck charting lib: http://www.harderweb.de/harderware/index.php?l=en&p=mrplot/
This isn’t related to the above, but I didn’t see your email address. The current version of the Pluralizer is out of date. I discovered that Rails 0.14 changed pluralization when it suddenly learned the plural of ‘quiz’ wasn’t ‘quizs’.
Thanks…the pluralizer has been updated to Rails 0.14.2.
The pluralizer has now been updated to Rails 0.14.2.
This looks awesome, anyone can post an example on how to use this in a rails app (on windows)?