November 22, 2014
Hot Topics:

Create Custom Web-based Graphs with the Google Chart API and PHP

  • January 19, 2010
  • By Jason Gilmore
  • Send Email »
  • More Articles »

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 <img> tag's src attribute. The provided data is sent along as a series of GET parameters.

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.


Read the full story at Web Developer's Virtual Library:
Create Custom Web-based Graphs with the Google Chart API and PHP


Tags: PHP, chart, Google, API




Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel