Damn Lies and Statistics

with no comments

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.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <img>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
To prevent spam, please type the two words you see below separated by a space. Can't read the words?