Jump to content

Creating graphs in php?


matthewhaworth

Recommended Posts

There are a lot of tutorials out there, but basically there are abotu 5-6 steps to making line graphs

 

step 1 Draw a shape (define the area with a box/gridlines)

step 2 Generate an array of values i.e ($nodes = array(1,4,6,2,3,5,7,65,2,34,1,23,);)

this array is going to be graphed with respect to their array index.  This is like saying each point was say a server load in mb at a given time taken at uniform intervals

step 3 a step distance ( i.e nodes/width of graph-20 pixel (padding));

step 4 now this is the tricky part the way you do this is with a dual counter function so basically you are drawing a point from $nodes[$i] to $nodes[$j] where $j = $i +1;  The second trick to this is you need to know your spacing based on step 3 for you x distance and your Y distance is the 2 nodes

step 5 add on extras/tweak it to your needs.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.