Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Creating charts and graphs in Rails...?
7 Posts
Creating charts and graphs in Rails...?

Hi All,

I have need to produce LINE, BAR, and PIE charts in Rails. I have found several that do all these. However the one caveat is that I can never find a solution that does all as well as XY-SCATTER. I've looked at Gruff,Scruffy,Gnuplot, etc. and none of them do "everything". Can anyone recommend a local (i.e. doesn't require network connectivity) library that can accommodate? GoogleCharts isn't an option as some of this will occur on closed networks.


I had a similar chart-hunting experience too. I finally ended up with Open Flash Chart: http://teethgrinder.co.uk/open-flash-chart/

It does line, bar, pie, and scatter + more

The Rails plugin can be found here: http://pullmonkey.com/projects/open_flash_chart

I've used it in a coupke of projects. Works OK. The only downside is that it requires flash....or that actually depends on your needs. You can make interactive-ish charts with it too because of the flash part. So that mighe be an advantage for some.

I'm not entirely in love with the flash bit myself, but it gets the job done fairly painlessly. Worth a try.


Yeah, I actually gave it a try, but I have a class named "Chart" already, and it appears that OFC requires use of that and wants to claim all existing references to "Chart" as its own -- with all of it's error-throwing badness. =\

Any ideas that don't involve me changing every reference to "Chart" in my code? Could I perhaps adjust it in the plugin? Or is there a better solution?

Hello Michael,

i have worked with Open Flash Chart. its really good and easy to use and you can understand its functionality easily. you can integrate to your application very easily.

you can have a quick look over the below URL. http://www.rorexperts.com/charts-in-rails-application-t594.html here its been explained in step wise manner.

i have also worked on 'ambling' charts. its too pretty good. if you are working with huge amount of data for charts you can go for ambling charts. here is the url you can have a useful information regarding the ambling http://www.amcharts.com/

Thank You, Uma.

Is there any way to generate charts independent of direct controller interaction? Basically I have a class - aptly named CHART - that I want to be responsible for generating it's own charts dynamically. However, for some reason I can't get it to render the chart on the page - there's just the perpetual spinning cursor.

As a bit of a side note, it would be really nice if developers documented more extensive cases for the use of their tools -- especially when the default demonstrations of functionality are limited.

Michael, it looks like the guy put up a git repository here: http://github.com/pullmonkey/open_flash_chart/tree/master

You might want to try out that version. It wraps all the charting into a module named OpenFlashChart, so that should get rid of your Chart naming clash.

His latest post on the package is here: http://pullmonkey.com/2009/4/30/open-flash-chart-ii-fully-automated

A perpetually spinning cursor on the chart usually means the chart wasn't able to load the data. OFC works in such a way that 1) you put the flash object on the page, and then 2) the flash object calls back your server on a predefined HTTP method to fetch the actual data points for that chart.

So a spinning cursor most likely means number 2 failed. Have a look at your server logs, if you didn't already. You should see the flash object trying to call your server for the data. That might help you sort out what's going on..


Ok, I will give OFC a try once more. I'm curious though. Is there any way of accomplishing connected "scatter" points? Basically I still want nice looking lines, just not at regular "synchronous" intervals as most "LINE CHARTING" libraries seem to assume. Also, given the non-synchronous line changes, is there any way to label each point with a value independent of it's numerical value? For instance, I'll need to plot the points based on TIMESTAMP.to_i, however, I want to actually have the "hover" value display the actual date. Any ideas?

Also, is there any way to scale the image?

7 Posts
Login to add your message