Graphs Rails Plugin

If you need to need to generate bar graphs in your Ruby on Rails application you can use the CSS Graphs plugin. This plugin can create three styles of CSS bar graphs. To install this plugin using the plugin script as follows:

script/plugin install

As soon as you install this plugin you can start using the bar_graph, horizontal_bar_graph, and complex_bar_graph methods introduced to the ActionView by this plugin. To create a simple graph you can use the following code in your rhtml view:

<%= bar_graph ['One', 40],
  ['Two', 20],
  ['Tree', 60],
  ['Four', 30],
  ['Five', 80]

You can use the same data with the horizontal_bar_graph and complex_bar_graph methods. That said, on Firefox on the OS X I was unable to display the complex_bar_graph. I also noticed that the bar_graph has a limit of five bars. And also on the bar_graph on the OS X I was not able to have spaces in my labels.

There is a different plugin by the name of Gruff that allows you to make image graphics. To use Gruff you will need to install and congifure ImageMagick and Ruby’s binding for ImageMagick. I have not had a need to use Gruff or the opportunity to tinker with it but that looks like a more robust solution for generating graphics.

Technorati Tags: , , , , , , ,

Related posts:

  1. Rails PDF Plugin
  2. Riff Rails Plugin
  3. Rails Flash Charting Plugin
  4. Acts As Voteable Rails Plugin
  5. Rails Google Analytics Plugin
  6. Updating A Rails Plugin

Leave a Reply