setPieSize(150, 135, 100);
# add a legend box where the top left corner is at (330, 50)
$c->addLegend(330, 60);
# modify the sector label format to show percentages only
$c->setLabelFormat("{percent}%");
# Set the pie data and the pie labels
$c->setData($data, $labels);
# Use rounded edge shading, with a 1 pixel white (FFFFFF) border
$c->setSectorStyle(RoundedEdgeShading, 0xffffff, 1);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='{label}: US\${value}K ({percent}%)'"));
?>
Pie Chart with Legend (1)
Pie Chart with Legend (1)
renderHTML(); ?>