根据表单提交数据_PHP编写做出动态饼图

管理员 发布于 7年前   353

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);  


请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

该博客于2020-12-7日,后端基于go语言的beego框架开发
前端页面使用Bootstrap可视化布局系统自动生成

是我仿的原来我的TP5框架写的博客,比较粗糙,底下是入口
侯体宗的博客

      订阅博客周刊

文章标签

友情链接

HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群
侯体宗的博客