sandy1028 Posted July 27, 2007 Share Posted July 27, 2007 Hi, How to plot the graph when width and height is fixed and average is increased more than 100..... Please help me with this <? $avg=10; $max=50; $graphValues=array($avg); $imgWidth=100; $imgHeight=50; // Create image and define colors $image=imagecreate($imgWidth, $imgHeight); $colorWhite=imagecolorallocate($image, 0, 255, 255); $colorGrey=imagecolorallocate($image, 192, 192, 192); $colorBlue=imagecolorallocate($image, 0, 0, 255); $colorred=imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $colorGrey); for ($i=1; $i<2; $i++){ imageline($image, $i*50, 0, $i*50, 100, $colorGrey); imagefilledrectangle($image, 0 , 0, $graphValues[0],$max,$colorred); } // Output graph and clear image from memory imagepng($image); imagedestroy($image); ?> Link to comment https://forums.phpfreaks.com/topic/61971-graph-when-fixed-width-and-height/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.