I’m back in Ireland for a little while. ‘Tis the season for merrymaking, munching mince pies, imbibing wine and—if you’re a geek—fiddling with code. That’s what I’ve been doing, sitting by the fire with my Macbook on my lap, hacking on Huffduffer.
I’ve been messing around with Google’s Chart API. I thought it would be nice to have some discreet little sparklines on profile pages. I had a little help from the ghost of Christmas past in the form of Brian’s 24 Ways article from last year.
The data I’m graphing is activity over time (huffduffing in this case). The time stamp of the first action is the starting point. The current time stamp is the end point. This timeline is then divided into 50 equal parts; the final sparkline will be 150 pixels long, giving 3 pixels per time period. Each action is allocated to the appropriate time slot. Once that’s done, the results are normalised according to the largest amount. So if the maximum activity in the timeline is six, then six becomes 100%; if the maximum activity is just one, then one is 100% and the resultant chart will be quite spiky.
You can see an example sparkline on my huffduffer profile, showing my huffduffing history at a glance. While I was at it, I added sparklines to tag pages as well. Here’s the tag page for “music”. I’ve styled them so that they don’t stand out too much. They’re supposed to look like quick pencil sketches.
For more than you ever wanted to know about sparklines, here’s Sparklines: theory and practice from the Ask E.T. forum.
Find photos that I took on December 26th, 2008.