Creating a Line graph.
Moderator: General Moderators
-
Simon Angell
- Forum Commoner
- Posts: 45
- Joined: Fri Jan 24, 2003 12:14 am
Creating a Line graph.
Hi.
I am looking to make a line graph using data from an outside file.
In this case its called Temp.log
In Temp.log the data is written like
9.1,2350
9.0,0000
8.6,0010
8.5,0020
8.2,0030
etc etc
With the first being the Temperature, and the second (after the comma) being the time.
How can i get php to get open that file, parse the data and output the relevent Line graph?
I am looking to make a line graph using data from an outside file.
In this case its called Temp.log
In Temp.log the data is written like
9.1,2350
9.0,0000
8.6,0010
8.5,0020
8.2,0030
etc etc
With the first being the Temperature, and the second (after the comma) being the time.
How can i get php to get open that file, parse the data and output the relevent Line graph?
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
OK cannot go into too much depth as don't have time so to give you some pointers....
http://de3.php.net/manual/en/ref.filesystem.php
and
http://de3.php.net/manual/en/ref.image.php
http://de3.php.net/manual/en/ref.filesystem.php
and
http://de3.php.net/manual/en/ref.image.php
use these ready made functions. Just feed it the numbers and it does the rest!
Easy!
http://www.panacode.com/panachart/
Mark
Easy!
http://www.panacode.com/panachart/
Mark
Bech100 - that's not exactly learning PHP 
Using the GD library to generate bar graphs (or pie charts, or anything) is ridiculously easy. Just work out the presentation maths, and you're halfway there. Reading the data from the format you've said is trivial, too.
If you want to learn something, use GD. If you want to get it done sooner, use panachart
Using the GD library to generate bar graphs (or pie charts, or anything) is ridiculously easy. Just work out the presentation maths, and you're halfway there. Reading the data from the format you've said is trivial, too.
If you want to learn something, use GD. If you want to get it done sooner, use panachart
-
Simon Angell
- Forum Commoner
- Posts: 45
- Joined: Fri Jan 24, 2003 12:14 am
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
-
Simon Angell
- Forum Commoner
- Posts: 45
- Joined: Fri Jan 24, 2003 12:14 am
Hi.
I decided to look at the pana chart, and am currently sorting thorugh the code - decoding it of sorts. now the data input in the test file is like this
In the example it is the vCht4 data being used..
I wan't the data to be grabbed from an external source (Temp.log)
In Temp.log the data is written like
9.1,2350
9.0,0000
8.6,0010
etc etc and as i stated before the numbers before the , is the plot ($vCht4)
and after is the label $vLables.
How do i get it to read and parse the temp.log file?
(sorry for asking what is a simple question - id rather get this thing working quickly then going through and changing things when i get time as needed etc etc)
I decided to look at the pana chart, and am currently sorting thorugh the code - decoding it of sorts. now the data input in the test file is like this
Code: Select all
$vCht4 = array(60,40,20,34,5,52,41,20,34,43,64,40);
$vCht5 = array(12,21,36,27,14,23,3,5,29,23,12,5);
$vCht6 = array(5,7,3,15,7,8,2,2,2,11,22,3);
$vLabels = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');I wan't the data to be grabbed from an external source (Temp.log)
In Temp.log the data is written like
9.1,2350
9.0,0000
8.6,0010
etc etc and as i stated before the numbers before the , is the plot ($vCht4)
and after is the label $vLables.
How do i get it to read and parse the temp.log file?
(sorry for asking what is a simple question - id rather get this thing working quickly then going through and changing things when i get time as needed etc etc)