What Graphing Packages/Apis Exist for Ruby

Drawing Library for Ruby

The simple answer is that (at time of writing) what you want almost certainly didn't exist. Sorry!

If you're Windows-based then I'd look for a product in the .NET space, where I expect you'd find something. You're probably going to have to pay real money though. I suppose, if you're brave, you may be able to talk to it using IronRuby.

From a non-MS environment I would be hoping for a Java-based solution. As already mentioned, within the Web world, you're going to be hoping some something JavaScript-based, or probably more likely, something from the Flash (or maybe even Silverlight?) world.

Actually, if you want to stay in Ruby and don't mind some risk, Silverlight might be a way to go - assuming the DLR stuff actually works (no experience here). Ruby - much as I love it - hardly has the most mature GUI structure around it.

Update: Since writing this (approaching 5 years ago) the situation has improved - a little. While I'm still not aware of any specific Ruby graph-drawing libraries, there is improved support for Graphviz here (Github) or by gem install ruby-graphviz. I've found that for simple graphs, it's quite possible to write the script directly from Ruby.

What is an easy way to display graphs in Ruby?

Check out http://railscasts.com/episodes/223-charts as a possible solution.

Ruby: How to display charts from Google Analytics?

Garb is a ruby library for Google Analytics, that will help you get the numerical data.

Once you have the data, you can use the Google Chart API to graph it in a bunch of different ways.

Google Chart API Ruby lib: googlecharts

What is your preferred way to produce charts in a Ruby on Rails web application?

Google Charts is an excellent choice if you don't want to use Flash. It's pretty easy to use on its own, but for Rails, it's even easier with the gchartrb gem. An example:

GoogleChart::PieChart.new('320x200', "Things I Like To Eat", false) do |pc| 
pc.data "Broccoli", 30
pc.data "Pizza", 20
pc.data "PB&J", 40
pc.data "Turnips", 10
puts pc.to_url
end


Related Topics



Leave a reply



Submit