CSS Graphs Helper for Ruby on Rails

Description

A Ruby on Rails helper for making simple graphs. The graphs use only CSS/HTML (and an optional gradient image).

Vertical bar graphs, horizontal bar graphs, and complex bar graphs with an image marker.

Inspiration thanks to Apples to Oranges.

Author

Geoffrey Grosenbach, boss@topfunky.com

Contributions by

Download

Issue this command inside your Rails app:

./script/plugin install http://topfunky.net/svn/plugins/css_graphs

It automatically installs itself into the default Rails helpers, so you don’t have to!

You can also copy the graphics to your images directory with the generator:

# No arguments are needed
./script/generate css_graphs

Sample

Usage

In your view:

<%= bar_graph  [['Gouda', 24], 
                 ['Havarti', 9], 
                 ['Provolone', 81], 
                 ['Wensleydale', 57], 
                 ['Stilton', 42]] %>

NOTE: Earlier versions took a splatted array. It now takes a single array of arrays.

Limitations of the First Release

  • Only one graph can be used per page.
  • Values must be in the range 0-100.

Examples in the Wild

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Ads by The Lounge

Manufactured with

Subscribe

Subscribe (RSS)