Excellent Dynamic Chart API by Google

21 03 2008

Google is trying to get rid of a lot of an ancient programming problem: generating charts. Mostly you have to install GD or ImageMagick or something similar and all kinds of libaries just to get to one chart! Their API got rid of the overhead and you can start creating your own charts just by providing the metadata required to visualize it.

Parameters are separated with the ampersand (&) character. You can specify as many parameters as you like, in any order. For example, the Chart API returns the following chart in response to the URL below:

Yellow pie chart

http://chart.apis.google.com/chart?
chs=250x100
&chd=t:60,40
&cht=p3
&chl=Hello|World

Where:

  • http://chart.apis.google.com/chart? is the Chart API’s location.
  • & separates parameters.
  • chs=250x100 is the chart’s size in pixels.
  • chd=t:60,40 is the chart’s data.
  • cht=p3 is the chart’s type.
  • chl=Hello|World is the chart’s label.

You can include a Chart API image in an HTML document by embedding a URL within an <img> tag. For example, the following img tag results in the same image as above:

<img src="http://chart.apis.google.com/chart?
chs=250x100
&chd=t:60,40
&cht=p3
&chl=Hello|World
&alt=Sample chart/>

A Maxcode pie-chart

Maxcode by night…

The following types of charts are available:

Click here for the API.

Advertisement

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.