Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Ruby API for Open Flash Chart. At the moment this creates the JSON required by OFC. You can use Ofchart, which is like Gchart, or you can use the underlying Ofc library.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Ofchart (& Ofc)
Ofchart is a Ruby API around the Open Flash Chart 2 library from John Glazebrook at (

In the end, all this library does is generate the right JSON for OFC2 - and really, that is all it needs to do.

In brief
Ofchart is an attempt to make using Open Flash Chart as Rubyish as possible, with some specific nods to charting. To do this there are actually two libraries in use: Ofc & Ofchart

	Ofc is the object oriented way of dealing with the details of Open Flash Chart 2. This library is a contract with OFC2 that gave me a way to anchor Ofchart. Ofc has all the building blocks needed to create the charts supported by OFC2.
	Ofchart is a different beast. I took some guidance, and some code, from the Googlecharts (Gchart) library that lets you call a chart like this:  Gchart.line(:title => 'my title', :size => '400x600') also, Gchart uses some theme support which is sorely lacking in the OFC world. Ofchart uses a similar API and includes the support for similar themes (the files are identical) with a few changes. 
Hopefully, calling Ofchart like this: => 'my bar chart', :theme => 'default', :size => '400x400', :data => [1,2,3,4,5]) is much better than composing the underlying Ofc::Chart & Ofc::Elements objects then calling to_json on the whole mess.

What's next
I am currently putting this project in a Rails application to see how it holds up. Improvements will get rolled back in as I make them and, I would expect, a Rails plugin-ish thing will be extracted to ease that pain.

	rspec (to run the tests)

That reminds me
Ofchart & Ofc have what is the nice start to a test suite. You can run them like this: rake spec

Something went wrong with that request. Please try again.