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 #11 - Exploded Flat Pie graphs

Pie chart are slightly differents than classical line / curve / plot chart.

First of all they can only accept one serie of data ( Serie1 in this example ). You can also specify in another serie the label associated to each points ( Serie2 in this example ). In this example we're manually feeding the series using the AddPoint() method of the pData class. Then we're associating Serie2 as the Abscise serie using the SetAbsciseLabelSerie() function. We're then calling the drawFlatPieGraphWithShadow() and drawPieLegend() functions to draw the graph. Shadow parameters are set using the setShadowProperties() function.

Running this script will create a example13.png file in the current directory.

Source code :
  // Standard inclusions   

  // Dataset definition 
  $DataSet = new pData;

  // Initialise the graph
  $Test = new pChart(300,200);

  // Draw the pie chart

If you want to send the picture directly in a browser, replace the Render() command by Stroke().

Last updated on 08/29/2008