Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Draw pie chart php

Sun Oct 26, 2008 11:20 pm

Code:
<?php
$myImage
= ImageCreate(300,300);

$white = ImageColorAllocate ($myImage, 255, 255, 255);
$red  = ImageColorAllocate ($myImage, 255, 0, 0);
$green = ImageColorAllocate ($myImage, 0, 255, 0);
$blue = ImageColorAllocate ($myImage, 0, 0, 255);
$lt_red = ImageColorAllocate($myImage, 255, 150, 150);
$lt_green = ImageColorAllocate($myImage, 150, 255, 150);
$lt_blue = ImageColorAllocate($myImage, 150, 150, 255);

for (
$i = 120;$i > 100;$i--) {
    
ImageFilledArc ($myImage, 100, $i, 200, 150, 0, 90, $lt_red, IMG_ARC_PIE);
    
ImageFilledArc ($myImage, 100, $i, 200, 150, 90, 180, $lt_green, IMG_ARC_PIE);
    
ImageFilledArc ($myImage, 100, $i, 200, 150, 180, 360, $lt_blue, IMG_ARC_PIE);
}

ImageFilledArc($myImage, 100, 100, 200, 150, 0, 90, $red, IMG_ARC_PIE);
ImageFilledArc($myImage, 100, 100, 200, 150, 90, 180 , $green, IMG_ARC_PIE);
ImageFilledArc($myImage, 100, 100, 200, 150, 180, 360 , $blue, IMG_ARC_PIE);

header ("Content-type: image/png");
ImagePNG($myImage);

ImageDestroy($myImage);
?>




Post a reply
  Related Posts  to : Draw pie chart php
 make Dynamic Bar Chart by php     -  
 How to generate dynamic 3d pie chart in php???     -  
 Chart enhancement (upgrading to 3D preferable)     -  
 Print a chart that shows how many number in each range     -  
 How to draw a gun     -  
 Draw An Arc in java     -  
 Draw Filled Arc php code     -  
 Draw Triangle using Lines     -  
 Draw 3d cube using openGL     -  
 draw Oval in java     -  

Topic Tags

PHP Graphics