My first flash pie chart looks wonderful. Actually there are many other chart types such as bar chart and radar chart etc. You can find more at here.
So now i would like to put the labels on the chart to indicate the actual meaning of the figures. Here is an example shows you how to add labels on the lovely pie chart.
Adding labels on the pie chart of FlashChartHelper in CakePHP
<?php
$data = array(0 => array('Animal' => array('id' => 1, 'name' => 'Rabbit', 'quantity' => 123)),
1 => array('Animal' => array('id' => 2, 'name' => 'mouse', 'quantity' => 78)),
2 => array('Animal' => array('id' => 3, 'name' => 'dog', 'quantity' => 98)),
3 => array('Animal' => array('id' => 4, 'name' => 'cat', 'quantity' => 65)),
);
echo $flashChart->begin(array('prototype'=>true));
$flashChart->setTitle('Chart Title', '{color:#f1a334;font-size:25px;padding-bottom:20px;}');
echo $flashChart->setData($results, '{n}.Animal.quantity', '{n}.Animal.name', 'stuff');
echo $flashChart->chart('pie', array(), 'stuff', 'chart1');
echo $flashChart->render(400, 400, 'chart1', 'chartDomId1');
?>
<div id="chartDomId1"></div>
Unlike the previous pie chart in FlashChartHelper @ 1, i render the chart to the div with id = “chartDomId1” instead of rendering it directly on the php code.
