Comment Timeline Visualization
While gawking at some of the really cools toys by Moritz Stefaner , I got particularly interested in his post about visualizing time gaps in data and had a moment of inspiration.
Instead of vertically gaping the data, you could “timeline” the data like we used to do in gradeschool. (I was also looking at some sparklines today too…).
So, I implemented the idea on the blog here. Now, this post won’t serve well to illustrate the effect, but if you fly back to a post that had some activity, you’ll find that as you read the comments, the yellow tick above each comment shows you the relative position in the discussion when the comment took place. Neat, out of the way, and very easy to grep. I like it.
For those who care, the code is really, really simple. For Wordpressers, in you comments.php add these lines right after <ol class=”commentlist”>
<?php
$last_comment = $comments[count($comments)-1]->comment_date;
$bar_length = strtotime($last_comment) - strtotime($post->post_date);
$bar_length = $bar_length + ($bar_length*.04); // 4% slack, width of each 'tick mark'
?>
Then, inside the foreach ($comments as $comment) loop and right after the <li>, add this:
<div class="commenttimeline"><div style="left: <?php
echo floor( ((strtotime($comment->comment_date) - strtotime($post->post_date)) / $bar_length ) * 100 );
?>%"></div></div>
Then you set up some basic styles for the bar (these will vary a LOT depending on your theme/style/etc):
.commentlist li {
position: relative;
_height: 1px;
}
.commenttimeline {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 2px;
background: #666;
_width: 102.5%;
}
.commenttimeline div {
position: absolute;
top: 0;
background: #cc0;
height: 2px;
width: 4%;
_line-height: 1px;
_font-size: 1px;
}
Yes, a few IE hacks were needed. :/
And ta da, instant comment timeline above each comment. Pretty cool.
Ooh, Thats pretty nice!
Seems neato!
This is very spiffy indeed.
oh boi!
hi
Hi the site is no fonction! The site is not refreshing. Please repare this.
Not refreshing, Anonymous? Try a swim in a mountain lake…
Nice technique, now make it animated. (J/k ;P)
Hey guys, off topic, but 2 players apparently hacked there way to the top you can see this here : since ur hard drive melted :( http://bf2stats.nl/ thats rele messed up, newayz. Keep up the good work, absolutely love the bf2s.com w00t! and haxxors ruin the game for everyone, get a life ppl! :P
fascinating
hey Jeff! sorry to post it here, but got a question regarding yer stats plug!
after activation it gives a finger to me, something like this
Fatal error: Cannot access empty property in /home/isynth/public_html/wp-content/plugins/wp-shortstat.php on line 771
whats that do you know?
thanx for help!