Er is geen CSS ondersteuning.
Om een 3d pie chart met php op jouw scherm te zetten heb je minimaal de hieronderstaande code nodig. Maak een file met de naam "pie-chart.php" en plaats de code daarin.
<?php
$dikterand = 8;
$piechart = imagecreate(200,200);
$achtergrondkleur = ImageColorAllocate ($piechart, 0, 34, 0);
$rood = ImageColorAllocate ($piechart, 128, 0, 0);
$groen = ImageColorAllocate ($piechart, 0, 128, 0);
$blauw = ImageColorAllocate ($piechart, 0, 0, 128);
$paars = ImageColorAllocate ($piechart, 128, 0, 128);
$geel = ImageColorAllocate ($piechart, 200, 200, 0);
$turkoois = ImageColorAllocate ($piechart, 0, 128, 128);
$lichtrood = ImageColorAllocate($piechart, 255, 30, 30);
$lichtgroen = ImageColorAllocate($piechart, 150, 255, 150);
$lichtblauw = ImageColorAllocate($piechart, 150, 150, 255);
$lichtpaars = ImageColorAllocate ($piechart, 128, 150, 128);
$lichtgeel = ImageColorAllocate ($piechart, 128, 128, 150);
$lichtturkoois = ImageColorAllocate ($piechart, 150, 128, 128);
for ($i = (100 + $dikterand);$i > 100;$i--) {
ImageFilledArc ($piechart, 100, $i, 200, 150, 0, 230, $lichtrood, IMG_ARC_PIE);
ImageFilledArc ($piechart, 100, $i, 200, 150, 230, 280, $lichtgroen, IMG_ARC_PIE);
ImageFilledArc ($piechart, 100, $i, 200, 150, 280, 320, $lichtblauw, IMG_ARC_PIE);
ImageFilledArc ($piechart, 100, $i, 200, 150, 320, 340, $lichtpaars, IMG_ARC_PIE);
ImageFilledArc ($piechart, 100, $i, 200, 150, 340, 350, $lichtgeel, IMG_ARC_PIE);
ImageFilledArc ($piechart, 100, $i, 200, 150, 350, 360, $lichtturkoois, IMG_ARC_PIE);
}
ImageFilledArc($piechart, 100, $i, 200, 150, 0, 230, $rood, IMG_ARC_PIE);
ImageFilledArc($piechart, 100, $i, 200, 150, 230, 280, $groen, IMG_ARC_PIE);
ImageFilledArc($piechart, 100, $i, 200, 150, 280, 320, $blauw, IMG_ARC_PIE);
ImageFilledArc($piechart, 100, $i, 200, 150, 320, 340, $paars, IMG_ARC_PIE);
ImageFilledArc($piechart, 100, $i, 200, 150, 340, 350, $geel, IMG_ARC_PIE);
ImageFilledArc($piechart, 100, $i, 200, 150, 350, 360, $turkoois, IMG_ARC_PIE);
header ("Content-type: image/png");
ImagePNG($piechart);
ImageDestroy($piechart);
?>
Vanuit deze basis kan je alles doen wat je verder maar wilt. Je kan het zo ingewikkeld maken als je zelf maar wilt. Maar dat is op deze pagina niet aan de orde. Hier wordt alleen maar een voorbeeld gegeven van een basis 3d pie-chart.
Om de 3d pie op jouw scherm te "zetten" hoef je alleen maar een regel code in de body toe te voegen, als:
<img src="pie-chart.php" width="200" height="200" alt="pie chart" />
cache 02-02-2012