我想创建一个从mysql中的数据填充的饼图图像。
示例:
imagefilledarc($image ,125 ,125 , 200, 200, 0, 180, $navy, IMG_ARC_PIE);
imagefilledarc($image ,125 ,125 , 200, 200, 180, 360, $red, IMG_ARC_PIE);
有关如何实现这一目标的任何建议吗?
代码:
<?php
include( "./inc/header.inc.php");
include ("./inc/connect.inc.php");
?>
<?php
$TeamName = "";
$TeamID = "";
}
else
{
$result = mysql_query("SELECT COUNT(DISTINCT MatchEventID) FROM MatchEvent WHERE TeamID = '9' AND EventID ='7'");
$count = mysql_fetch_array($result);
$pass = $count[0];
}
}
//create image
$image = imagecreatetruecolor(250,250);
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
//allocate some colour
$white = imagecolorallocate($image, 0xFF , 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0 , 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90 , 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00 , 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00 , 0x00, 0x05);
$red = imagecolorallocate($image, 0xFF , 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);
imagefilledarc($image ,125 ,125 , 200, 200, 0, $pass, $navy, IMG_ARC_PIE);
imagefilledarc($image ,125 ,125 , 200, 200, $pass, 360, $red, IMG_ARC_PIE);
//flush image
header('Content-type: image/png');
imagepng($image);
//imagedestroy($image);
?>
由于