Google’s charting API has been around for quite a while now, but I’ve only just needed to actually look at it. It became immediately obvious that I needed a PHP encoding function, so off to google I went. Though I found several implementations, they were all incomplete or deficient in one way or another (and it didn’t help that there was an error in google’s extended encoding docs), so I’ve written my own based on several different ones. Both simple and extended encoders support automatic scaling, inflated maximum and lower-bound truncation, so you can pretty much stuff whatever data you like in, with no particular regard for pre-scaling and you’ll get a usable result out. They have an identical interface, so you can use either encoding interchangeably according to the output resolution you need (contrary to popular belief, the encoding to use has very little to do with the range of values you need to graph). By default, the full range of possible values is used as it just seems silly not to. I deliberately omit the ‘s:’ and ‘e:’ prefixes so that you can call these functions for multiple data series, and I include a function that does just that. You still need to generate your own URLs and other formatting, but that’s a different problem. Read on for the code… Continue reading “Google Charts API Simple and Extended Encoders in PHP”
Google Carbon Footprint app launch
Over the last year I’ve been involved with the guys at d::gen. d::gen have put together the AMEE (Avoiding Mass Extinction Engine) Carbon Calculator, which has since been chosen by DEFRA as the official carbon calculator for the UK, and provides back end for the ActOnCO2 site as well as providing a public repository of official carbon emissions data.
Today marks the launch of the next big thing in AMEE’s short history: Google’s Carbon Footprint application, which is available as a gadget on Google’s UK iGoogle home page.
The app was developed by Avenue A / Razorfish. My role at d::gen has been to deal with server and application configuration, deployment, hosting and monitoring, database configuration and load testing.
AMEE continues to grow in flexibility, ability, capacity and content, all while remaining a shining example of the ‘right way’ of running an open-source project.
Anyway, congratulations d::gen and AMEE, and thanks to Google and Razorfish for using us!
Now if you’ll excuse me, I have to go and deal with the prospect of being on the receiving end of a link from a Google home page….