GChart -- An object-oriented PHP library for drawing charts
About GChart
GChart provides a collection of classes for drawing data charts using Google Chart APIs. Google Chart API lets you dynamically generates charts just using URL. For example, this 3D-pie chart can be produced through <img src="cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World" />.
As you see, using Google Chart APIs directly is simple but very inconvenient. GChart can make it easier. Since GChart is written in PHP, the image above can be generated by the following code:
<?php
$pie3d=new GChart_Pie3D(250,100);
$pie3d->add(60,'Hello');
$pie3d->add(60,'World');
?>
<img src="<?php echo $pie3d->get_image_string(); ?>" />
Obviously, it is more intuitive and understandable than the long, complex URL.
Features
GChart implements most of Google Chart APIs' functions. Up to now, you can use GChart to create the following charts:
- Pie Chart (including 2D-pie chart and 3D-pie chart)
- Line Chart
- Bar Chart (including vertical bar chart and horizontal bar chart)
- Radar Chart
- Scatter Plot Chart
- Google-O-Meter Chart
- QR-Code Chart
Also, you can add labels or legends. You can set the chart color and background, etc. There are many excellent features in GChart. For the complete reference, see GChart API document. I also prepare a brief tutorial. Hava fun!
Download GChart
The newest version of GChart can be downloaded from Sourceforge.net.
History:
- 2008-9-16: GChart 0.1 released.