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
Line graph
Cubic curve graph
Bar Graph
Stacked Bar Graph
Overlay Bar graph
Line + Area
Limits graph
Filled line graph
Filled cubic graph
Radar graph
Basic Pie graph
Exploded Pie graph
3D Pie graph
Scatter charts
Advanced Examples
Example #13 - Creating a bar graph

This example shows how to create a simple bar graph containing three data series. Data are manualy set using the AddPoint() method of the pData class. The graph function called is drawBarGraph() setting the shadow drawing to TRUE. When doing bar graph, be sure to scale it setting the $WithMargin parameter of the drawScale() function to TRUE. parameters. Running this script will create a example12.png file in the current directory.

Output :

Source code :
  // Standard inclusions   

  // Dataset definition 
  $DataSet = new pData;

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

  // Draw the 0 line

  // Draw the bar graph

  // Finish the graph
  $Test->drawTitle(50,22,"Example 12",50,50,50,585);
If you want to send the picture directly in a browser, replace the Render() command by Stroke().

Last updated on 05/15/2008