You can do a pie chart with a combination of arc and polygon functions (there really ought to be a built-in command for this)
<?php
$canvas = new Imagick();
$canvas->newImage(600, 600, 'grey');
image_pie($canvas, 300, 300, 200, 0, 45, 'red');
image_pie($canvas, 300, 300, 200, 45, 125, 'green');
image_pie($canvas, 300, 300, 200, 125, 225, 'blue');
image_pie($canvas, 300, 300, 200, 225, 300, 'cyan');
image_pie($canvas, 300, 300, 200, 300, 360, 'orange');
$canvas->setImageFormat('png');
header("Content-Type: image/png");
echo $canvas;
exit;
function image_arc( &$canvas, $sx, $sy, $ex, $ey, $sd, $ed, $color = 'black' ) {
$draw = new ImagickDraw();
$draw->setFillColor($color);
$draw->setStrokeColor($color);
$draw->setStrokeWidth(1);
$draw->arc($sx, $sy, $ex, $ey, $sd, $ed);
$canvas->drawImage($draw);
}
function image_pie( &$canvas, $ox, $oy, $radius, $sd, $ed, $color = 'black' ) {
$x1 = $radius * cos($sd / 180 * 3.1416);
$y1 = $radius * sin($sd / 180 * 3.1416);
$x2 = $radius * cos($ed / 180 * 3.1416);
$y2 = $radius * sin($ed / 180 * 3.1416);
$points = array(array('x' => $ox, 'y' => $oy), array('x' => $ox + $x1, 'y' => $oy + $y1), array('x' => $ox + $x2, 'y' => $oy + $y2));
image_polygon($canvas, $points, $color);
image_arc($canvas, $ox - $radius, $oy - $radius, $ox + $radius, $oy + $radius, $sd, $ed, $color);
}
function image_polygon( &$canvas, $points, $color = 'black' ) {
$draw = new ImagickDraw();
$draw->setFillColor($color);
$draw->setStrokeColor($color);
$draw->setStrokeWidth(1);
$draw->polygon($points);
$canvas->drawImage($draw);
}
?>