Filed under: grails | Tags: grails, grails-charts, grails-plugins, open-flash-chart
The new version of Chart Plugin is available.
This version is not compatible with previous versions of plugin, because it’s based on OFC-2 and the others on OFC.
OFC-2 uses JSON to populate the chart:
{“title”:{“text”:”Mon Mar 09 14:56:10 BRT 2009″},”is_decimal_separator_comma”:0,”elements”:[{"values":[9,8,7,6,5,4,3,2,1],”font-size”:10,”type”:”line”}],”num_decimals”:2,
“is_fixed_num_decimals_forced”:0,”is_thousand_separator_disabled”:0}
You don’t need to create JSON manually, grails plugin includes a Java API for OFC called jofc2, thats provides a programatically approach to generate the JSON data. The same json above can generate with:
new Chart(new Date().toString())
.addElements(new LineChart()
.addValues(9, 8, 7, 6, 5, 4, 3, 2, 1))
In soon a DSL will be created in plugin to allow creation of charts easily, and you are free to create your way or use another java library to generate the JSON data.
To install plugin just type:
grails install-plugin ofchart
The use of plugin is extremely easy, first you need to add some resources in you page, in head section put:
<ofchart:resources/>
So you are ready to put the chart in your page:
<ofchart:chart name=”demo-chart” url=”${ createLink( action: ‘load’ )}” width=”400″ height=”200″/>
Just this, now you are ready to use the open flash chart in your grails applications.
To see a demo, checkout the plugin from svn:
svn checkout http://svn.codehaus.org/grails-plugins/grails-ofchart/tags/RELEASE_0_6/ ofchart
run with:
grails run-app
And go to:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
This is the first version with the OFC2 , so it does not have many features, if you have some suggestion, please open a issue in jira.
For further information about plugin, see the official wiki page.
For information and documentation about jofc2 library see the official web page.
21 Comments so far
Leave a comment






Awesome news! Kudos on the release! Did you mention this on the OFC forum? That’s definitely the best place to foster discussion about your 0.6 release.
Comment by Eric Caron March 10, 2009 @ 15:23excellent one,
Comment by adwin March 16, 2009 @ 04:26btw is this plugin only for grails 1.1 up ? can i use this on 1.0.4 ?
got my thumbs up….
Works a treat….
Trackback by got my thumbs up. March 17, 2009 @ 18:06Hi mchiareli , Can I create to 2 axis on Chart in Open Flash Chart 0.6
Comment by DANNY March 24, 2009 @ 09:21Because I have big series and small series
I find y_axis_right funtion in , But I can’t use the funtion on grails OFC 0.6
Hi Danny, you want to create a axis in the left and one in the right side?
What kind of chart do you want to use?
Could you send a example?
Comment by mchiareli March 27, 2009 @ 18:40I want to use Line chart
like the chart
http://teethgrinder.co.uk/open-flash-chart/gallery-y-axis-4.php
thank you
Comment by DANNY March 29, 2009 @ 02:36is grails’ ofc depends on prototype ?
Comment by adwin March 29, 2009 @ 03:41it seems i need to use it along with my jquery without conflictiong each others
Works a treat.
Comment by got my thumbs up. April 1, 2009 @ 16:02After deploy my test I have a JSON parse error, in the gsp I put betwen head tag, in a div I put , in a controller I have an action called (load) with
Comment by crgio July 22, 2009 @ 11:01new Chart(new Date().toString())
.addElements(new LineChart()
.addValues(9, 8, 7, 6, 5, 4, 3, 2, 1)), that’s the way or the wrong way?
in the head —>
Comment by crgio July 22, 2009 @ 11:02betwen div —>
Hi , I want to add click event , exsample
http://teethgrinder.co.uk/open-flash-chart-2/line-on-click.php
How to coding the API for OFC , thanks
Comment by DANNY August 3, 2009 @ 03:50hi danny, the java library jofc2 doesn’t support the click event.
So, you need to create the json manually, or estend the jofc2 to support it.
I was working in a dsl to create the charts with full support to OFC features, but i’m very busy now.
Sorry.
Comment by mchiareli August 3, 2009 @ 12:30Can u pls specify the exact steps ,How to to create the json manually
Thanks for your quick reply.
Comment by DANNY August 3, 2009 @ 21:39Actually, the click event is supported by jofc2, but it renders incorrect JSON. The simple fix is to do this (assuming ‘c’ references your chart object):
render c.toString().replaceAll(‘key-on-click’, ‘on-click’)
Comment by Ola November 12, 2009 @ 18:10I have a strange bug with Stacked Bar Chart Tooltips, can you confirm that?
Seems like it’s a OFC issue anyway…
I have opened a JIRA Issue:
http://jira.codehaus.org/browse/GRAILSPLUGINS-1453
kind regards,
Comment by Flo August 26, 2009 @ 12:59Flo
Great plugin thanks very much.
I have a questio, how would i set up the wmode parameter?
using the grails tag?
thanks
Comment by carlos orrego December 21, 2009 @ 11:55Hello there,
this is simply amazing! I love it!
Thanks a lot…
Giovanni
Comment by Giovanni March 8, 2010 @ 09:34Is it possible to get the grails source code to add a fix a few things?
Many thanks
Comment by rene April 13, 2010 @ 20:13yeap.
you can checkout from
http://plugins.grails.org/grails-ofchart/
Comment by mchiareli April 14, 2010 @ 08:41Are you using the latest version of OFC2? 28th, July 2009?
Comment by Kevin April 29, 2010 @ 13:57[...] I never used Open Flash Charts before and decided to spend one afternoon and play with it. It was very easy to install and take into use, just by following the short instruction from http://mybytes.wordpress.com/2009/03/09/grails-open-flash-chart-06-is-out [...]
Pingback by Uncategorized, technologia, english, Blog / Open Flash Chart 2 on Grails - December 8, 2011 @ 09:22