It's Christmas Eve and time for some fun! A few weeks back I published an article on Reactive Extensions where I created a Bing Maps / Twitter mashup that plotted the geolocation of #uksnow twitter tags. This twitter hashtag was popularised by Ben Marsh and is used by us weather obsessed brits to give a realtime update of snowfall. To use this hashtag tweet #uksnow with your postcode and the amount of snowfall out of ten (e.g. 7/10).
The snow has continued to fall in record quantities across the uk, so I thought it might be fun to create "#uksnow The Movie", where you can replay the snowfall across the UK. You can see the finished app below. Hit the 'play' button, or drag the time indicator on the chart to replay the snowfall and re-live the fun! You can also mouse-over the snowflakes to see the original #uksnow tweet.
To create this application I modified my original app to extract as many #uksnow tweets from twitter as possible. Unfortunately the public search API only server tweets from the last ~ 7 days. If anyone knows of a free historic service, please let me know!
The application above contains an XML file with all the historic tweets. When it starts up, it parses the XML file.The chart displays the tweets 'binned' in 30 minute intervals, which is achieved via a simple
I used the free Visiblox chart to display the tweet frequency. A
LineSeries with a
BindableDataSeries is used to render the results of the query above using databinding.
The Visiblox chart has a pluggable behaviour concept which allows you to add interactivity to the chart. The vertical line that indicates the current time uses this behaviour framework. When the user interacts with the chart via mouse movements, these interactions are directed to any active behaviours, which can then update their state, possibly interacting with the chart or its axes. For example, when the code which updates the date as the user drags the line is shown below:
For the sake of simplicity, the calendar and clock controls are implemented as UserControls, for example the calendar has the following markup:
And the following minimal code-behind:
The clock control is very similar, using a few concepts that I wrote abut in my gauge control blog post a few weeks back. It is good to see that Silverlight allows quick and direct implementations of controls, you do not always have to use MVVM, lookless controls and dependency properties. If it is Christmas Eve, and you are itching to get home and grab a drink, anything goes ;-)
You can download the full sourcecode here: UKSnowTheMovie.zip
Right ... I'm off home.
Regards, Colin E.