MySQL Graphing

Soldato
Joined
14 Feb 2006
Posts
4,644
Location
Surrey, UK
Evening all,

OK, so I have a MySQL database with some data (suprisingly enough), one field of which is a UNIX timestamp. Another of these is "temperature".

Now a record is added to the database automatically every fifteen minutes. Somehow I'd like to automatically pick out data from the database and generate a graph of the temperatures over the last 24 hours. Ie. Time along the x-axis and temperature up the y-axis.

I've had a look at things like JPGraph, but I'm not very experienced with PHP and MySQL (I've done a reasonable amount, but by no means am I an expert). Is this the best way to go about doing this?

The basic concepts of JPGraph I understand, but how would I extract the data from the database into an array that I can then feed into JPGraph? And how do I get time along the x-axis?

Thanks for any help, it really is appreciated!

Jon
 
Thanks for the replies both of you :)

For the moment I think I'll carry on trying JPGraph, I've managed to get the data out of the database and create a simple line graph of it.

The bit I'm currently having problems with is how to get the time along the x-axis. The time for each data point is stored in the database in a UNIX Timestamp format. And I'd like to convert this to a "real" time (which I can do in PHP) and then display it along the x-axis.

Jon

EDIT: Done it :) I'm sure I'll be back with another question soon!
 
Last edited:
Back
Top Bottom