Graphing with PHP: Line Graphs

In our tutorial last week, Graphing with PHP, we started building a class that you could use to draw a graph using the PHP Image functions.

We used a simple data holding object that contained all of the data that we needed to draw our graph, and then passed that to a graph drawing script by storing the data temporarily in a Session variable on the server. This method allowed us to use our PHP image drawing scripts as the SRC of an IMG tag so that the dynamic graphics could be embedded within an HTML page.
 
At the moment, our class just plots asterisks, so the first thing that we will need to do is change our graph from drawing in asterisk characters for the plot points, to using an actual line. It's helpful to have read the last tutorial, but all the code is supplied for download to allow you to product dynamically-generated line graphs on the fly from PHP.
$2.89
- OR -

Overview

Table of Content:

  • Connect the dots
  • Additional labels
  • Adding labels to the y axis
  • Adding labels to the x axis

Allan Kent

Allan KentAllan comes from Cape Town, South Africa. He has been implicated in writing for several WROX, glasshaus, Wiley and Apress publications, generally in the 'cool stuff that PHP can do' sections.

You can catch up with him at his website http://www.mediafrenzy.co.za.

See All Postings From Allan Kent >>

Reviews

Be the first to write a review

You must me logged in to write a review.