Eye-catching graphics with the Google Charts API

Chart Your Heart Out

The Google Chart API is simple to use and easy to integrate into web applications. As shown here, you can use the API immediately – just embed a static link in your web page and let the browser request and render a chart each time the page is drawn.

To speed page rendering, you can request and cache the chart image on your own server, recreating the chart only when the underlying data changes. In addition to providing better efficiency, this technique better protects your raw data. A visitor to your site cannot "View Source" and copy the URL.

Of course, you can also mix the Google Chart API with AJAX techniques to modify charts on the fly in response to user input. Chart Maker [6] is a basic but effective demonstration of dynamic charting; others have used the Google Chart API to implement a loan calculator and executive dashboards.

Of course, Google Chart is often slower than charting tools that run on the desktop, such as Apple Numbers or Microsoft Excel. These latter applications use native drawing engines and do not require an Internet round-trip to transmit data and download a large graphic image. However, Google Chart is a free application that is available from anywhere. If you are serious about using Google Chart in a production setting, pre-flighting and caching can greatly improve response time.


  1. The pChart graphing framework for PHP: http://pchart.sourceforge.net/
  2. The Google Charts API documentation: http://code.google.com/apis/chart/
  3. BeeTagg: http://www.beetagg.com/
  4. Google's free Zebra Crossing barcode reader library: http://code.google.com/p/zxing/
  5. A guide to encoding data in QR codes: http://code.google.com/p/zxing/wiki/BarcodeContents
  6. A simple Google Chart generator: http://almaer.com/chartmaker/
  7. The JFreeChart charting library: http://www.jfree.org/jfreechart/

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Perl: Google Chart Instructions

    A CPAN module passes drawing instructions in object-oriented Perl to Google Chart, which draws visually attractive diagrams.

  • Tutorial – LibreOffice Charts

    Everybody needs charts sooner or later, and LibreOffice Calc is the easiest way to create them with free and open source software.

  • Perl: Pinpointing Spammers

    To identify the geographic regions from which link spam originated, a database locates IP addresses and the Google Charts service puts them onto a world map.

  • Wanderlust

    For running statistics on his recorded hiking trails, Mike Schilli turns to Go to extract the GPS data while relying on plotters and APIs for a bit of geoanalysis.

  • ProjectLibre

    ProjectLibre helps you organize and optimize a complex project with lots of moving parts.

comments powered by Disqus