本程序是根据用户提供的数据生成3D效果的百分比图片统计效果,实例代码如下:
- $image = imagecreatetruecolor(200,200);
-
-
- $red = imagecolorallocate($image,255,0,0);
- $blue = imagecolorallocate($image,0,0,255);
- $yellow = imagecolorallocate($image,255,255,0);
- $violet = imagecolorallocate($image,255,0,255);
- $white = imagecolorallocate($image,255,255,255);
- $black = imagecolorallocate($image,0,0,0);
-
-
- for($i=120;$i>100;$i--){
- imagefilledarc($image,100,$i,200,120,0,30,$red,img_arc_pie);
-
- imagefilledarc($image,100,$i,200,120,30,80,$blue,img_arc_pie);
- imagefilledarc($image,100,$i,200,120,80,360,$yellow,img_arc_pie);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- imagearc($image,100,100,200,120,0,360,$black);
- imagefilledarc($image,100,100,200,120,0,30,$red,img_arc_pie);
- imagefilledarc($image,100,100,200,120,30,80,$blue,img_arc_pie);
- imagefilledarc($image,100,100,200,120,80,360,$yellow,img_arc_pie);
-
-
- $str = iconv ("gbk","utf-8","36%");
- imagettftext($image,10,360-15,100+70,115,$white,"simhei.ttf",$str);
-
- imagejpeg($image);
- imagedestroy($image);
-
|