SourceForge.net  |  Sunyday.net
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 www.pchart.net.
Overview  |  Screenshots  |  Download  |  Add-ons  |  Demonstration  |  Support  |  :: Documentation ::
Documentation Contents
Overview
Class definition
FAQ
Using pChart with MySQL
Playing with colors
Setting X labels
Series are drawn black?
Debugging charts
Call to undefined function
Digging with pChart
Basic Examples
Advanced Examples
Debugging charts

You'll probably face a day issues while drawing a chart. Since release 1.27, we've introduced error pre-checking that is correcting common issues and the ability to report the error messages directly on the console (for console called script or script that are using the Render() function to generate image) or to print the messages over the generated pictures (for scripts that are sending the picture directly to the user browser calling the Stroke() function).

To turn on error checking add the following call :
 $Test->ReportWarnings();
Specifying no parameter will determine the output (Console/GD) depending on the renderin method (Render/Stroke). You can force the reporting output specifying :
 /* This will print errors to the command line STDOUT */
 $Test->ReportWarnings("CLI");

 /* This will print errors over the generated picture using GD */
 $Test->ReportWarnings("GD");
Debugging to the console

If you choose to send debugging informations to the console, you mustn't call the Stroke() function as messages will be directly displayed to STDOUT by the pChart library breaking the picture. You'll see a broken picture in your browser or a page of ununderstandable characters. A typical call will display something like :
  C:\Web\pChart>php -q Example19.php
  [Warning] drawCubicCurve - Some series descriptions are not set.
  [Warning] drawLegend - Some series descriptions are not set.

  C:\Web\pChart>
Debugging using GD

If you are generating on-the-fly pictures it can be cool to integrate the error messages directly in the rendered picture to see if something is going wrong. Messages will be written in a red box aligned on the bottom-right corner of the pictures like in this example :


What is checked and fixed today

The following items are checked while calling scaling or chart-drawing functions

Data Structure
  - Is there data in the series (no fix)
  - Are the series containing the same amount of data (no fix)

DataDescription Structure
  - Is there a serie associated to the Y labels (using serie "Name" as default)
  - Do we have a description set for all series (using the serie name as default)


Last updated on 08/12/2008