Jump to content

Problem in plotting


sandy1028

Recommended Posts

Hi,

 

Facing problem in plotting when the fixed width and heigth is given

 

$graphValues=array($avg,$max);

// Define .PNG image
header("Content-type: image/png");
$imgWidth=50;
$imgHeight=15;

// 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);

$avg_val= ($imgWidth * $avg)/$max;


//verticle lines
imageline($image, $i*50, 0, $i*50, 50, $colorGrey);
imagefilledrectangle($image, 0 ,0,$avg_val,$imgWidth,$colorred);
//Horizontal lines

//destroy the image
imagepng($image);
imagedestroy($image);


Link to comment
https://forums.phpfreaks.com/topic/62442-problem-in-plotting/
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.