总结
豆包 AI 助手文章总结

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

php中文网
发布: 2016-07-13 10:47:33
原创
982人浏览过

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

/*
 * Created on 2009-5-26
 *author:deepblue
 */

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

?>

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

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
豆包 AI 助手文章总结
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号