Google recently released a fantastic API for generating dynamic charts. It's really simple and is well documented but does place a limit on the number of requests you can make per day. In most cases your chart data probably doesn't change often so it isn't really necessary to request a new chart from Google for each page view.
I've created a simple caching proxy which solves this issue. It requests charts from Google based on configuration files and caches the result. The cached image is then used for subsequent requests until it expires (configurable). Here's an example of how you might call the script:
<img src="http://www.ejeliot.com/samples/chart-cache/chart.php?config=simple" width="250" height="100" alt="Chart of some data">
The single parameter, "simple" refers to the filename of the configuration file you want to use (excluding path and file extension). Configuration files are simply sets of key/value pairs corresponding to the GET parameters passed to Google Charts plus a couple of special properties which define caching characteristics. Here's an example:
# simple chartexpiry = 300cht = p3chd = s:hWchs = 250x100chl = Hello|World
The configuration files can also contain PHP which will be interpreted before values are passed to Google.
# simple chartcache = yesexpiry = 300 # time in secondscht = p3chd = s:hWchs = 250x100chl = Hello|<?php echo rand(0, 10); ?>
It's important to note that configuration files aren't cached (at least for the moment) so any data you retrieve within them, from a database for example, should be cached separately. If you don't have code to achieve this already you can download a caching class I wrote a while ago.
If you're looking for more information about Google Charts, beyond the developer API documentation, check out Brian Suda's recent 24ways article which provides a simple introduction.
