PHP產生3D的百分比圖形統計效果_PHP教程

來源:互聯網
上載者:User
PHP產生3D的百分比圖形統計效果本程式是根據使用者提供的資料產生3D效果的百分比圖片統計效果有一點像中國站長

php教程產生3d的百分比圖形統計效果
/*
本程式是根據使用者提供的資料產生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/633030.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/633030.htmlTechArticlePHP產生3D的百分比圖形統計效果本程式是根據使用者提供的資料產生3D效果的百分比圖片統計效果有一點像中國站長 php教程產生3d的百分比圖形...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.