Home About Me

A Chart Is Just a URL Away

Google's Chart API turns chart creation into URL construction. Instead of adding a charting library, you assemble the right URL and Google returns an image you can embed in a page.

For a basic pie chart split 60 to 40, the HTML is:

<img src="/images/169bb119b5bd2a40a5a65a9d911a898d00514de77cec58b2e225d79d5cbdbc6a.png" alt="" />

It renders as:

Pie chart with a 60/40 split

The API supports a wide range of chart styles. A sparkline, for instance, can be produced with a compact URL and colored with a parameter:

<img src="/images/183fa20707795f66a400a8a9516df26933fa7db5552092990424caa92208ea90.png" alt="Sparkline chart in blue" />

Blue sparkline chart

Map-style charts are available too, as shown by this Africa example:

<img src="/images/7965d859567313d7af7d7c277457d98c98515efd8096dc96b7d32a1f05e6ba74.png" alt="Map of Africa" />

Map-style chart of Africa

The full set of chart types and options is documented at http://code.google.com/apis/chart/.