Plotting tweets in real-time using Smoothie Charts and Kwwika

13 Aug 2010

I noticed a tweet today about real-time JavaScript charts and couldn't resist having a play. The charts are call Smoothie Charts and have been developed by Joe Walnes. You can read the blog post where he announced the release of them here.

The demos that I've seen don't use real-time data so I thought I would create a small demo using real-time tweets being pushed through Kwwika. I updated the Kwwika TweetStreamer component (which I must get around to putting in GitHub) to push through updates from some popular hashtags including #nowplaying, #news, #tech and a few others and then wrote a bit of code to count the number of tweet updates over an interval and push that value into a Smoothie chart. The result looks like this (Smoothie charts use Canvas so only work in some browsers. I've tested this demo in Firefox and Chrome):

You can see the Smoothie Twitter Real-Time Charting demo using Kwwika here: http://kwwika.com/Standalone/Demos/javascript-examples/smoothie-twitter-charting/

I've got the Smoothie chart showing the number of updates for each twitter hashtag, a table showing the count and a list of the tweets at the bottom.

The code is in GitHub so feel free to fork/download and have a play yourself. You can run the code on http://localhost but in order to get the code to work on your own website you'll need to register with Kwwika and get in touch to let us know you want access to the real-time Twitter hashtag topics.

Update: We found a bug in the Smoothie library which Joe Walnes promptly fixed.

One thing we've noticed is that the Smoothie chart stops working and throws an exception and as yet we've not been able to work out what the problem is due to lack of time. It's probably something to do with not getting any updated values in a TimeSeries. This is what the exception look like in Firebug:


If anybody can work out what the problem is please let us know. Failing that we'll look into it when we can.

Permalink

| Leave a comment  »