Posts Tagged ‘graphs’

How to generate a wave graph

Thursday, June 10th, 2010

TV watching - split by channel

I revisited the code behind my TV scrobbling this evening. When I first wrote it, I focused on graphs like bar graphs and pie charts.

Tonight, I tried out wave graphs. In this post, I want to share some of the results of my first attempt, and how I wrote the script to generate them.

I have created wave graphs showing my TV watching over the last five months. I’ve tried splitting it out by in a couple of ways:

Programme titles tend to be too long to make for a very useful graph, and there were way too many of them. But I’ve tried limiting them to the top 10 watched programmes to make for a prettier graph. The channels graph seems to work okay, though.

TV watching - split by channel

To generate the graphs, I wrote a Python script using the awesome graphication graphing library by Andrew Godwin.


Drawing pretty graphs with Open Flash Chart

Friday, December 19th, 2008

I’m keen for young people that Solent Youth Action works with to have access to information about how the charity runs. I’d like for us to be as transparent as possible, and as a geek, one of the ways that I am working on this is by putting more stuff on our website.

We put our Financial Statements online so that people could see where we get our money from, and how we spend it. But it’s a dry document – a twenty-two page PDF of numbers and accounting blurb.

While it is important for this information to be available, it’s not easily accessible to many like this. Tonight I had a play with presenting it as animated online graphs using the awesome Open Flash Chart.

The Open Flash Chart site has very clear tutorials and a ton of examples, so I wont waste time here by going into detail explaining how to use it.

But it’s worth highlighting just how simple it is – drop the swf file into a directory on your webserver, then point it at a JSON file with your data (either by URL, or by reference in your HTML). That’s pretty much it.

The most complicated bit was copying figures out of the Financial Statements document and pasting it into a JSON text file. Even this was fairly quick.

Flash graphs are not as accessible as something like Google Chart images because they require Flash to be installed. However, I hope the visual flair they add makes up for this, and will help grab the attention of our volunteers.

I created a couple of quick charts to show our income and expenditure, but there are many more examples of how to use it here and here.