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 =)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.