FlashChartHelper @ 1

The CakePHP website which i am working has a voting module. So after voting, i would like to show the vote result graphically instead of listing the corresponding vote figure next to the vote option in text. So i search on the web and find the FlashChartHelper. The following steps show u how to create u own lovely chart. Try it!

Simple Flash Chart by FlashChartHelper in CakePHP

1. Download the Flash Chart Helper at here
2. The version used in this project is FlashChartHelper_3.3.91
3. Extract the zipped files to the appropriated paths in the cakephp application project

  • Please note that the open-flash-chart.swf should be at the ~/webroot folder instead of ~/webroot/flash

4. Include the helper in the Controller

var $helpers = array('FlashChart');

5. Include the javascript in the view

<?php
   echo $javascript->link('prototype');
   echo $javascript->link('swfobject');
?>

6. Add the sample pie chart in the view

<?php
   echo $flashChart->begin(array('prototype'=>true));
   $flashChart->setToolTip('#percent# of 100%');
   $flashChart->setTitle('Cake chart','{color:#f1a334;font-size:25px;padding-bottom:20px;}');
   $flashChart->setData(array(13,3));
   echo $flashChart->pie(array('start_angle' => 59,'values' => 'true', 'tooltip' => '#val# of #total#<br>#percent# of 100%'));
   echo $flashChart->render(400,250); 
?>

7. That’s all! =)

Reference: FlashChartHelper

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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