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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.