Jump to content

Recommended Posts

Hi,

 

How to mark the $avg and $max at the middle and end of rectangle using imageString.

The marking should be outside the rectanle

 

 

$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);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorred=imagecolorallocate($image, 255, 0, 0);


imagefill($image, 0, 0, $colorGrey);

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


//verticle lines
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/63150-rectangle/
Share on other sites

You need to make the image large enough for the barchart and the text labels

[pre]

+--------------------------------+

|                          100  |

|  ||||||||||||||||||||||||    |

|            50                |

+--------------------------------+

Link to comment
https://forums.phpfreaks.com/topic/63150-rectangle/#findComment-314775
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.