473,414 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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

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

Marc
<?
// Add values to the graph
$graphValues=array(0,80,23,11,190,245,50,80,111,24 0,55);

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

// 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
imagepng($image);
imagedestroy($image);
?>

Feb 18 '06 #1
1 1673
monomaniac21 wrote:
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

Marc


Use jpgraph. Or gnuplot. If you're just masochistic see the notes on
http://www.php.net/manual/en/function.imagechar.php

C.
Feb 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeff | last post by:
Hi I have a report with a graph on it and want to change the minimum and maximum values for the value axis when it is previewed. This can't be done by adding code in the Open event as once the...
3
by: Jeff | last post by:
Does anyone have any suggestions about a good third party graph control. The one in Access seems confusing to use. Is there a control that could be said to be an industry standard? Jeff
3
by: Claus Haslauer | last post by:
Hi, I want to create a chart value (y-axis) vs. time (x-axis). In fact very similar to the xy(scatter) example in the graph10.chm help-file. I ran into problems, so I started a very basic *.mdb...
2
by: smith.mariya | last post by:
hi, i am mariya. i am working on vb.net. i have created the powerpoint addin. i have inserted the chart on the slide through vb.net code. now, i want to remove the gridlines on the chart and want...
2
by: gabsaga | last post by:
The following code creates a chart in Powerpoint with data from an Access query. Question I have is how to set the font and alignment of the data points on my X-axis. I want my alignment to be 90...
6
by: ravindarjobs | last post by:
Hi friends, i am using ms access 2003. I have used ms graph in a form. Now i want to set the x-axis and y-axis titles programatically. usaully we set titles for axis by going to chart options...
0
by: Just_a_fan | last post by:
Some folks have searched, from time to time, for a dual axis MSChart with different scales on the two Y axes. The sample, extracted from running code I wrote, produces a graph with MSChart (VB9)...
0
by: eureka2050 | last post by:
Hi all, I am creating a radar chart containing 2 plots using jpgraph. My code is as follows:- include ("./jpgraph/src/jpgraph.php"); include ("./jpgraph/src/jpgraph_radar.php"); //...
0
by: russtee | last post by:
I am creating crystal reports line graphs using vb.net. When the number of records is small it labels the x-axis. When the number of points is large it doesn't label them at all. I need to be able...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.