Plot the graph against fixed width and height
Posted: Thu Jul 26, 2007 10:44 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
How to plot the graph when width and height is fixed and average is increased more than 100.....
Please help me with thisCode: Select all
<?
$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);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]