码迷,mamicode.com
首页 > Web开发 > 详细

php画一个背景透明,且开始处旋转到在圆的正下方处的一个圆饼统计图

时间:2014-08-04 02:03:36      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:des   color   java   io   for   cti   ar   javascript   

/*
 * _survey 得到一个投票的圆饼图
* @access public 表示函数对外公开
* @param $_agree 同意票数
* @param $_disagree 反对票数
* return 一张统计圆饼图
* */
function _vote($_agree,$_disagree){
    //处理参数
    if($_agree==0&&$_disagree==0){
        $_vote = 270;
    }
    if($_agree==0&&$_disagree!=0){
        $_vote = 91;
    }
    if($_agree!=0&&$_disagree==0){
        $_vote = 89;
    }
    if($_agree!=0&&$_disagree!=0){
        $_vote = intval(360*($_agree/($_agree+$_disagree))+90);
    }
    //创建画布
    $_img=imagecreatetruecolor(150,100);
    //填充透明背景
    imagealphablending($_img, false);
    imagesavealpha($_img, true);
    $white = imagecolorallocatealpha($_img,255,255,255,127);
    imagefill($_img,0,0,$white);
    //创建颜色
    $_green=imagecolorallocate($_img,180,210,52);
    $_blue=imagecolorallocate($_img,83,201,237);
    $_gary=imagecolorallocate($_img,192,192,192);
    $_green1=imagecolorallocate($_img,149,178,36);
    $_blue1=imagecolorallocate($_img,41,160,193);
    $_gary1=imagecolorallocate($_img,144,144,144);
    
    for($i=60;$i>=50;$i--){
        imagefilledarc($_img,100,$i,100,50,90,$_vote,$_blue1,IMG_ARC_PIE);
        imagefilledarc($_img,100,$i,100,50,$_vote,90,$_green1,IMG_ARC_PIE); 
    }
    
    imagefilledarc($_img,100,$i,100,50,90,$_vote,$_blue,IMG_ARC_PIE);
    imagefilledarc($_img,100,$i,100,50,$_vote,90,$_green,IMG_ARC_PIE);
    
    header("content-type: image/png");
    imagepng($_img);
    imagedestroy($_img);
}


php画一个背景透明,且开始处旋转到在圆的正下方处的一个圆饼统计图,布布扣,bubuko.com

php画一个背景透明,且开始处旋转到在圆的正下方处的一个圆饼统计图

标签:des   color   java   io   for   cti   ar   javascript   

原文地址:http://blog.csdn.net/yanlintao1/article/details/38363671

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!