Last release: 1.27d
a PHP Class to build Charts
pChart 2.x is born, you can start moving your script to this new version. The new website is at
Overview  |  Screenshots  |  Download  |  Add-ons  |  Demonstration  |  Support  |  :: Documentation ::
Documentation Contents
Class definition
Digging with pChart
Basic Examples
Advanced Examples

This documentation has been last updated on 06/18/2008.

pChart - a chart drawing library

Thank you for using pChart, we hope that you'll find the answer to your questions in this documentation. If not, feel free to use the dedicated sourceforge forum and tracker.
Drawing a chart can be cut in 3 parts : First, get access to the data and prepare it to be graphed ( you can use the pData class to help ). Second, prepare the graph design : rounded corners, freaky background, drawing area and then draw the chart! Last step, put some labels, title and legends. Your chart can now be saved in a web server folder or sent directly to the client browser.

Using the library

This class can be invoked for realtime picture drawing or cron/scheduled tasks. Rendering a graph is CPU consuming, we recomment that all static graphs ( or with a renewal interval of more than 10 minutes ) should be computed from a cron job, this also apply to web sites serving a lot of page views.

pChart is using the GD library to create pictures. You must compile the GD library with the freetype extension when installing PHP on a linux server. On windows operating system you must add the GD extension in your php.ini file. GD support is a mandatory prerequisite and cannot be overriden. You can use the following tutorial if you don't know how to install it on a linux server.
If you plan to use pChart on a production web service, keep an eye on project updates & progress list. We'll try to focus on increasing the graphical render speed.
A section of this documentation is dedicated on how to use pChart to render scheduled jobs ( windows & linux )

This graph is a simple -naked- rendering using the pChart library:

   // Standard inclusions   

   // Dataset definition 
   $DataSet = new pData;
   $DataSet->SetSerieName("Sample data","Serie1");

   // Initialise the graph
   $Test = new pChart(700,230);

   // Draw the line graph

   // Finish the graph
   $Test->drawTitle(60,22,"My pretty graph",50,50,50,585);
Icons embeding the documentation are created and released by under the GNU 2.5 license. The javascript syntaxhighlighter library used to display PHP & JS code in this documentation is released under the GNU license.

Last updated on 06/18/2008