CodeIgniter Forums
fusioncharts plugin - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: fusioncharts plugin (/thread-17751.html)



fusioncharts plugin - El Forum - 04-14-2009

[eluser]mmiranda[/eluser]
Hi, i found a very simple tutorial on using fusionchart as plugin, its here:

http://www.ikawka.com/2008/12/fusion-chart/

would any of you mind to share with me how to create the view?
I think mychart() will be in the controller, the example is not using a model, so the missing part is the view, am i correct?


fusioncharts plugin - El Forum - 04-16-2009

[eluser]Mike Ryan[/eluser]
Hi,

Correct - you just need to pass the chart data to a view and echo it.

Create this function in your controller:

Code:
function mychart(){
    $this->load->plugin( 'fusion' );
    $FC =  FusionCharts("Column3D","520","200");
    $arrData = array( 500, 269, 254, 895, 633);
    foreach( $arrData as $i=>$data ){
        $FC->addChartData( $arrData );
    }
    $strParam="numberSuffix=%; formatNumberScale=0; decimalPrecision=0; xAxisName=Integrated Process Average Score; animation=1";
    $FC->setChartParams($strParam);
    $FC->setChartMessage("ChartNoDataText=Chart Data not provided; PBarLoadingText=Please Wait.The chart is loading...");
//my changes start here
    $data['chart'] = $FC->renderChart(false,false);
    $this->load->view('chart_test');
}

The most basic view would look like this:

Code:
//file: chart_test.php
echo $chart

I haven't used this plugin myself, but the above code should get a basic chart on the page... or at least an error message ;-)

If it doesn't work, post any error messages or output and I'll take a look. btw, amCharts is a nice Flash charts package, I found it very easy to integrate with CI, including some cool stuff like automatic updates via ajax.


fusioncharts plugin - El Forum - 04-17-2009

[eluser]Iverson[/eluser]
Have an example of an amCharts installation?


fusioncharts plugin - El Forum - 04-18-2009

[eluser]Mike Ryan[/eluser]
I'm afraid not - it was something I put together when I was testing Flash charting packages. I have actually decided to use pChart instead - not as "sexy" as Flash, but a lot more accessible. Next time I use amCharts in a project I'll write a proper library for it.