Time to ask a question. As a bit of a sub project / idea i have (like all my ideas i start and never complete.. whatdidido springs to mind).
But getting back to the question, i have a file, which in the script is processed and inserted into a table. (the file is massive, as its data about my PC temp / voltages).
What i want to do is get this data and be able to select by temp source (i.e. mobo or cpu) and by date and produce a graph. I have hacked some code and got it almost working, but i think the code i have hacked was doing something else (%ages).
So what is the best way to graph say the following data as a line graph?
<?php //.. Above this is the processing file bit and //..the DB reult bit (selecting from the DB) //..That all works fine
header ("Content-type: image/jpeg");
// --- Need to figure out width and size of the font. $font = 1; $fontHeight = ImageFontHeight ($font); $fontWidth = ImageFontWidth ($font);
// --- This is the number of rows $numAnswers = mysql_num_rows ($resulters); echo $numanswers; // --- This is the size of the image $width = 1200; //300 $height = 300; //200 $image = ImageCreate ($width, $height);
// --- Get the width of each item. $widthPerItem = ($width / $numAnswers);
As i can't work out what its doing (was for some polling thing), it doesn't work with a small pic size i.e. 400*80 which i want (sig time) but will work (or seems to work) with picture sizes of 15000*100. The data is taken every 5min so thats about 300 values of data per day.
Any ideas on how to do this, i.e. plat on make a line graph of the data?
Been having a play and altered the code substantially to whats above (instead of hacking i made my own version). what it ddoes now is select the array from mysql, and plot a line from point n to n+1 and then loops for all the variables. this is nearly working. When its done i'll post the code incase its of use to anyone else.