how to label the points on my graph (x and y axis)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all!

Ive got a very simple page shown below to draw a line graph and I need
some help, how do can i label each point on the X and the Y axis? The
lines are drawn with an imageline function, any ideas?

Kind regards


// Add values to the graph

// Define .PNG image
header("Content-type: image/png");

// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorBlue=imagecolorallocate($image, 0, 0, 255);

// Create GREY border around image
imageline($image, 0, 0, 0, 250, $colorGrey);
imageline($image, 0, 0, 250, 0, $colorGrey);
imageline($image, 249, 0, 249, 249, $colorGrey);
imageline($image, 0, 249, 249, 249, $colorGrey);

// Create grid using the imageline function to draw lines on the x and
the y (in grey)
for ($i=1; $i<11; $i++){

imageline($image, $i*25, 0, $i*25, 250, $colorGrey);
imageline($image, 0, $i*25, 250, $i*25, $colorGrey);

// Create line graph by looping through the data
for ($i=0; $i<10; $i++){
imageline($image, $i*25, (250-$graphValues[$i]), ($i+1)*25,
(250-$graphValues[$i+1]), $colorBlue);

// Output graph and clear image from memory

Re: how to label the points on my graph (x and y axis)

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Site Timeline