Damn Lies and Statistics

I spent the afternoon today putting together a simple Statistics Page for Brompt. I'm actually pretty happy with it---not to mention I'm able to keep the mind-alteringly green theme going strong.

statistics chart example

The chart on the stats page uses the Google Charts API, via a Drupal module called Charts (simply enough). I actually had to hack on it a bit since the module was strongly genericized (with a lean feature set) and I wanted to make a very clean looking, Google-Analytics-style chart, which meant adding in a lot of little code for things like axis labels, grids and color-fills. Stuff like this:

<?php
// Add Grid
if (!empty($data['#grid'])) {
 
$chart[] = 'chg='. $data['#grid'];
}
?>

Fun huh? In the end I probably could have just written a completely generic array parser that would format generic keys and values into the proper API URL for Google Charts to gnaw on. Something for another day, I guess.