php pie chart not rendering. why ?
<?php
$rows = array(80, 75, 53, 32, 20);
$sum = array_sum($rows);
for($i = 0; $i < count($rows); $i++) {
$rows[$i] = intval( round($rows[$i]*360/$sum) );
}
$img = imagecreatetruecolor(201, 201);
$white = imagecolorallocate($img, 255, 255, 255);
imagefill($img, 0, 0, $white);
$cx = $cy = 100;
$w = $h = 200;
$start = 0;
foreach ($rows as $value) {
$color = imagecolorallocate($img, rand(0, 255), rand(0, 255), rand(0, 255));
$angle_sector = $start + $value;
imagefilledarc($img, $cx, $cy, $w, $h, $start, $angle_sector, $color, "IMG_ARC_PIE || IMG_ARC_EDGED");
$start += $value;
}
header ("Content-type: image/gif");
imagegif($img);
?>
why its not rendering ??? i want to get a pie chart for which different colors are generated
source https://stackoverflow.com/questions/72650214/php-pie-chart-not-rendering
No comments:
Post a Comment