Month: April 2016

Super-simple D3 bar chart

No, it’s not quite a visually stunning world map or amazing graphic artistry, sadly.

BUT nevertheless –  here’s a little data visualisation that I wrote today with D3:


d3 bar chart data



It doesn’t look like much but took a ton of code to produce (well probably not, but it certainly felt like it). I had fun playing with the pretty colours, finally settling on a blue/purple scheme. The bar colours turn more blue the larger the number and more purple the smaller the number.

The dataset is just a simple array of numbers that I threw in. There’s a touch of CSS added in the document head to make the bits play nicely together. Other than that, this was an exercise in learning how to use SVGs, how to bind data onto elements in the DOM, and how to style the results in a very basic way. This is fascinating stuff. I love the way it can give me the potential to mingle coding with journalism and tell stronger, deeper stories.

I can see those gorgeous interactive maps awaiting me in the not-so-distant future… 😀