To help developers represent data as convenient charts such as this, Google (perhaps the reigning champion of data aggregation) released the Google Chart API in late 2007. In his Web Developer's Virtual Library tutorial, Jason Gilmore shows you how to use the Google Chart API in conjunction with PHP to create a variety of useful charts.
The Google Chart API is a Google service that allows you to dynamically create a variety of charts, given a data set and other relevant information such as the desired size, chart legends, and axis labels. Given this information, the service will respond with a link to the chart, which you can embed in an
src attribute. The provided data is sent along as a series of
You can create pie, line, bar, and radar charts, in addition to Venn diagrams, scatter plots, and even map-based charts. Further, the API offers quite a few options for tweaking the presentation, such as setting the chart color, creating three-dimensional charts, modifying the chart orientation, and much more.
You'll need to spend some time getting acquainted with the numerous parameters before you can begin effectively using the Google Chart API service, however. Google probably used such short parameter names to maintain an absolute minimum communication payload, yet this comes at the cost of readability. Rather than tediously memorize the ambiguous list of parameters, why not create a PHP class that will offer a much more friendly API interface? In fact, several such classes already exist! Of the three best-known solutions, Jason Gilmore recommends checking out GoogChart, stating that although it's far from complete, GoogChart seems to offer the easiest solution for building basic charts.