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
Graphs labels
Small "Fast Graphs"
Using pCache
Line style, Pics inclusion
Importing CSV data
Error reporting
Missing values
Playing with axis formats
Playing with backgrounds
High quality graphics
Customizing plot charts
2nd Y axis and shadows
Example #23 - Customizing plot charts

Since release 1.27b it is possible to associate a picture (only GIF files are supported) to one data serie. This picture will replace the bubles while drawing a plot chart. First associate one picture to one serie calling the SetSerieSymbol function of the pData class. The title of the chart is written over the grap area using the drawTextBox function setting a transparency factor of 30%

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

Output :

Source code :
  // Standard inclusions
  // Dataset definition
  $DataSet = new pData;
  $DataSet->SetSerieName("Company A","Serie1");
  $DataSet->SetSerieName("Company B","Serie2");
  $DataSet->SetYAxisName("Product sales");

  // Initialise the graph   
  $Test = new pChart(700,230);
  // Draw the title
  $Title = "Comparative product sales for company A & B  ";
  // Draw the line graph
  // Draw the legend
  // Render the chart
If you want to send the picture directly in a browser, replace the Render() command by Stroke().

Last updated on 05/15/2008