Welcome Guest, Not a member yet? Register   Sign In
fusioncharts plugin

Hi, i found a very simple tutorial on using fusionchart as plugin, its here:


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?

[eluser]Mike Ryan[/eluser]

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

Create this function in your controller:

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->setChartMessage("ChartNoDataText=Chart Data not provided; PBarLoadingText=Please Wait.The chart is loading...");
//my changes start here
    $data['chart'] = $FC->renderChart(false,false);

The most basic view would look like this:

//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.

Have an example of an amCharts installation?

[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.

Theme © iAndrew 2016 - Forum software by © MyBB