FlashChartHelper @ 3

Some times if you wanna show more than one chart in the view. You can make use of the render function such that different charts are shown in different div by providing the div id.

<?php
   echo $flashChart->begin(array('prototype'=>true));

   echo $flashChart->setData(array(1,3,6,9),'{n}',false,'stuff','chart1');
   echo $flashChart->chart('pie',array(),'stuff','chart1'); 
   echo $flashChart->render(400,400,'chart1','chartDomId1');
   
   echo $flashChart->setData(array(1,3,2,4),'{n}',false,'stuff','chart2');
   echo $flashChart->chart('bar',array(),'stuff','chart2');    
   echo $flashChart->render(400,400,'chart2','chartDomId2');
   
   echo $flashChart->setData(array(4,3,2,1),'{n}',false,'stuff','chart3');
   echo $flashChart->chart('line',array(),'stuff','chart3');    
   echo $flashChart->render(400,400,'chart3','chartDomId3');
?> 
<div id="chartDomId1"></div>
<hr>
<div id="chartDomId2"></div>
<hr>
<div id="chartDomId3"></div>

Make sure u have added the FlashChart helper in the controller before u make use of the above code in the view. Enjoy =)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s