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

If you don't need images, and can settle on requiring JavaScript, you could try a client-side solution like the jQuery plugin flot.


I am a fan of Gruff Graphs, but Google Charts is also good if you don't mind relying on an external server.


It requires flash and isn't free (though inexpensive): amcharts.

I've used it successfully and like it. I evaluated a number of options a while back and chose it. At the time, however, Google Charts wasn't as mature as it seems to be now. I would consider that first if I were to re-evaluate now.


There's also Scruffy. I took a look at the code recently and it seemed easy to modify/extend. It produces svg and (by conversion) png.