您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php绘制饼状图(imagefilledarc方法)

2024/5/4 15:57:34发布18次查看
1925,上海=>2016,广州=>1256,深圳=>980);
$arr_key = array_keys($array);$color = array();$im = imagecreatetruecolor(300,300);for($i=1;$i $color[] = imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));}//创建饼状图,由多个扇形组成
$a1=rand(0,360);$sum = array_sum($array);for($j=0;$j $a2 = $a1 + $arr_key[$j]/$sum*360; imagefilledarc($im,150,150,180,80,$a1,$a2,$color[$j],img_arc_pie); $a1 = $a2;} // bbs.it-home.org//输出图像
header(content-type: image/png);imagepng($im);//关闭
imagedestroy($im);?>
复制代码
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product