php畫一個背景透明,且開始處旋轉到在圓的正下方處的一個圓餅統計圖

來源:互聯網
上載者:User
/* * _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);}




相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.