GChart -- A PHP Library for Drawing Charts

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:

$pie3d=new GChart_Pie3D(250,100);
<img src="<?php echo $pie3d->get_image_string(); ?>" />

Obviously, it is more intuitive and understandable than the long, complex URL.


GChart implements most of Google Chart APIs' functions. Up to now, you can use GChart to create the following charts:

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.