Update 28/06/2010: For an updated version, read this link.
A while ago, I've accidentally stumbled upon FusionCharts Free (FSF). I liked them, and so I've decided to create this simple plugin for CakePHP.
In fact, this plugin is only a wrapper for the existing FSF class, with CakePHP users in mind. Id est, all params are passed as arrays, and then converted to FSF format internally.
Polar. Bear in mind that this is still a work in progress, so the plugin provides only the basic features of FSF, i.e. rendering charts in a simplistic manner.
The only thing that surprised me was the candlestick chart, which cannot be generated using the FSF PHP class. However, you can manually build the XML and set it as a source for the chart. I didn't try this, but it should be fairly easy to accomplish (in the next release).
Since this is the first release, the only way to use this plugin is to generate the charts using the FusionChartsComponent and then rendering it using the FusionChartsHelper. So basically, the helper doesn't have any tag-rendering capabilities just yet, but it will.
Also, being the first release, I've only wrapped the necessary methods to reconstruct all the demo charts shown in the official FSF download. Since a picture - or in this case a chart - is worth a thousand words, take a look at the demos:
These samples are included in the download, and basically are pseudo unit tests.
To use the plugin, unzip it in your
~/app/plugins folder and add the FusionCharts component and helper to your controller:
var $components = array('FusionCharts.FusionCharts'); var $helpers = array('FusionCharts.FusionCharts');
Look at the code samples within the plugin to see how to generate individual chart types. In my opinion the toughest was Gantt chart, with a lot of information needed for the graph to be rendered properly. That bastard.
In any case, the plugin can be downloaded here:
Please leave any comments and/or suggestions here or send me an e-mail to <neutrinocms[at]gmail.com>
Edit: Forgot to add this, thanks Bad Dog ;)
Update: This is only necessary for CakePHP 1.2!
Add route to app/config/routes.php
Router::connect ( '/fusion_charts/swf/:chart', array ( 'plugin' => 'FusionCharts', 'controller' => 'swf', 'action' => 'proxy' ) );