Integrating JFree Charts
If you haven't heard of JFree charts you should really take a look at what it can do. It's a completely free charting engine written entirely in Java by David Gilbert (no relation, at least none that I know of), and has a heck of a lot of charting options.
I spent a bit of time working with the samples trying to get it to work through Coldfusion and finally had some luck. I have found that trying to integrate complex Java applications in CF is not all that easy as we begin to bump up against some of the limitations of CF.
Firstly forget about trying to use Abstract classes or nested classes they just don't work (at least every way I tried didn't). In the code below I am trying to create a 2D ellipse to add to my data points on the line chart to make the data points more visible. If you do a search for java.awt.geom.Ellipse2D you find two nested classes: Ellipse2D.Double and Ellipse2D.Float. Any attempt to call the Double class as below just up an fails.
createObject("java","java.awt.geom.Ellipse2D").Double(javacast("double",'-5.0'), javacast("double",'-5.0'),javacast("double", '10.0'),javacast("double",'10.0'));
The Double method was not found.
Great! No luck there then....But other than that, I managed to create a couple sample charts (bar and line) and now just need to wrap the entire process into either a component or custom tag. I am thinking custom tag would be somewhat easier to use instead of a component as the number of attributes available for each series is quite large.
Conversly I could create a Java wrapper class that hides all of the Java complexity from Coldfusion and that way would only need to instantiate my Java class and pass in the appropriate values instead of having to try and mess with nested classes...

Subscribe
Subscribe via RSS
Follow me on Twitter
Or, Receive daily updates via email.
Tags
adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui
Recent Entries
No recent entries.
Blogroll
An Architect's View
CFSilence
Rey Bango
TalkingTree

<cfscript>
ell=createObject("java","java.awt.geom.Ellipse2D$Double").init(10,10,10,10);
</cfscript>
<cfdump var="#ell#">
Thanks Paul!