Jump to content

[SOLVED] Plot


sandy1028

Recommended Posts

Hi,

 

I am facing problem against plotting when passed from the array for fixed width and height of image...

 

Please help me with this

 

 

 

 

$graphValues=array(12,30);

// Define .PNG image
header("Content-type: image/png");
$imgWidth=30;
$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);

$maxv = 0;
//Taking the maximum value
for($i=0;$i<2;$i++){
$maxv = max($graphValues[$i],$maxv);
}

for($i=0;$i<2;$i++)
{


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

// Output graph and clear image from memory
imagepng($image);
imagedestroy($image);

?>


 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.