根据表单提交数据_PHP编写做出动态饼图
php  /  管理员 发布于 6年前   425
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);
博主 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..xiaoB 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..BUG4 在
你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..博主 在
go语言+beego框架中获取get,post请求的所有参数中评论 @ t1 直接在router.go文件中配就ok..Jade 在
如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号