threeddonutshading.php
Back to Chart Graphics
setBackground($c->linearGradientColor(0, 0, 0, $c->getHeight(), 0x0000cc, 0x000044));
$c->setRoundedFrame(0xffffff, 16);
# Set donut center at (100, 100), and outer/inner radii as 80/40 pixels
$c->setDonutSize(100, 100, 80, 40);
# Set the pie data
$c->setData($data, $labels);
# Set the sector colors
$c->setColors2(DataColor, $colors);
# Draw the pie in 3D with a pie thickness of 20 pixels
$c->set3D(20);
# Demonstrates various shading modes
if ($chartIndex == 0) {
$c->addTitle("Default Shading", "bold", 12, 0xffffff);
} else if ($chartIndex == 1) {
$c->addTitle("Flat Gradient", "bold", 12, 0xffffff);
$c->setSectorStyle(FlatShading);
} else if ($chartIndex == 2) {
$c->addTitle("Local Gradient", "bold", 12, 0xffffff);
$c->setSectorStyle(LocalGradientShading);
} else if ($chartIndex == 3) {
$c->addTitle("Global Gradient", "bold", 12, 0xffffff);
$c->setSectorStyle(GlobalGradientShading);
} else if ($chartIndex == 4) {
$c->addTitle("Concave Shading", "bold", 12, 0xffffff);
$c->setSectorStyle(ConcaveShading);
} else if ($chartIndex == 5) {
$c->addTitle("Rounded Edge", "bold", 12, 0xffffff);
$c->setSectorStyle(RoundedEdgeShading);
} else if ($chartIndex == 6) {
$c->addTitle("Radial Gradient", "bold", 12, 0xffffff);
$c->setSectorStyle(RadialShading);
} else if ($chartIndex == 7) {
$c->addTitle("Ring Shading", "bold", 12, 0xffffff);
$c->setSectorStyle(RingShading);
}
# Disable the sector labels by setting the color to Transparent
$c->setLabelStyle("", 8, Transparent);
# Output the chart
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='{label}: US\${value}K ({percent}%)'"));
}
# This example includes 8 charts
$viewers = array();
for ($i = 0; $i < 8; ++$i) {
$viewers[$i] = new WebChartViewer("chart$i");
createChart($viewers[$i], $i);
}
?>
3D Donut Shading
3D Donut Shading
renderHTML(), " ";
}
?>