Google Chart API via PHP
I promised to make the DokuWiki usage data collected by the new popularity plugin available some time soon. Because such data is much better to comprehend when accompanied by some nice graphs, I had a look at the Google Chart API today.
Their API creates all types of nice looking graphs from data supplied in a special URL format. Because I didn't felt like constructing those URLs my self I had a look at a few PHP classes that promise to wrap the Google API. There is a list of wrappers for various programming languages at the Google group. I played with three libs:
- GoogChart – very simple and basic
- GphpChart – nearly covers the whole API
- gchartphp – not all graphs supported
So far I can't really recommend any of those libs fully, though I used gchartphp for now. What I was especially missing was some logic that automagically prepares the data for the chart. Eg. I'd expect the library to create sensible scaled axis labels on its own. Calculating the needed granularity from a bigger dataset would be nice, too.
Maybe I haven't looked hard enough, yet. If you know of a simple to use Google Chart API class in PHP that is clever enough to display useful charts from any given data, give me a hint in the comments please.
For your entertainment, some graphs from current DokuWiki popularity data follows after the jump.
Used PHP Versions