imagefilledarc:
说明 在指定的 image 上画一椭圆弧且填充
bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )
1.//接收数据2.$aaa = $_POST['aaa'];
3.$bbb = $_POST['bbb'];
4.$ccc = $_POST['ccc'];
5.//运算
6.$d = $aaa+$bbb+$ccc;
7.$a = $aaa/$d*360;
8.$b = $bbb/$d*360;
9.$c = $ccc/$d*360;
10.
11.$im = imagecreatetruecolor(800, 600);
12.
13.$blue = imagecolorallocate($im, 0, 0, 200);
14.$gray = imagecolorallocate($im, 200, 200, 200);
15.$red = imagecolorallocate($im, 200, 0, 0);
16.
17.//得出动态人数比例
18.imagefilledarc($im, 200, 200, 200, 200, 0, $a, $blue, 0);
19.imagefilledarc($im, 200, 200, 200, 200, $a, $a+$b, $red, 0);
20.imagefilledarc($im, 200, 200, 200, 200, $a+$b, 0, $gray, 0);
21.
22.//动态饼图显示
23.header('content-type:image/jpeg');
24.imagejpeg($im);
25.//销毁画布
26.imagedestroy($im);