Jump to content

graph when fixed width and height


sandy1028

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.