php3d饼状图,php 生成3D饼形状数据统计图_PHP教程

php 生成3D饼形状数据统计图

$image = imagecreatetruecolor(200,200); //创建一张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循环创建3D效果底层效果

for($i=120;$i>100;$i--){

imagefilledarc($image,100,$i,200,120,0,30,$red,IMG_ARC_PIE);//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);

}

//bool imagefilledarc ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style )

//

//imagefilledarc() 在 image 所代表的图像中以 cx,cy(图像左上角为 0, 0)画一椭圆弧。如果成功则返回 TRUE,失败则返回 FALSE。w 和 h 分别指定了椭圆的宽和高,s 和 e 参数以角度指定了起始和结束点。style 可以是下列值按位或(OR)后的值:

//

//IMG_ARC_PIE

//

//IMG_ARC_CHORD

//

//IMG_ARC_NOFILL

//

//IMG_ARC_EDGED

//这个层是最上面一层的效果,这样立体效果就出来了!

imagearc($image,100,100,200,120,0,360,$black);//添加一个黑色的边圈,这样3D效果看起来更加明显点

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%");//如果要输入中文需要此转换。example:占用:30%;

imagettftext($image,10,360-15,100+70,115,$white,"simhei.ttf",$str);

imagejpeg($image);

imagedestroy($image);

?>

http://www.bkjia.com/PHPjc/632854.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632854.htmlTechArticlephp 生成3D饼形状数据统计图 ?php /* * Created on 2009-5-26 *author:deepblue */ $image = imagecreatetruecolor(200,200); //创建一张200*200的画布; //创建多种又区分...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值