Saturday, December 19, 2015

Radial Bar Chart Using D3.js - Part 1

I recently received an email regarding a class on learning data visualization using D3.js. On a linked webpage that gave more information about the class, there was an image of a chart (see below) that really resonated with me. I liked how it displayed a variable number of questions in equally weighted categories, similar to the layout of some survey data that I deal with at work. I thought this would be a great basis for building my own chart with some features specific to my own data. Because the image was on a page advertising a class on D3.js, I naturally thought it was created with D3.js.

Why People Go Online - Ruder Finn Intent Index

However, when I started looking on the web for a D3 version of the above chart, I stumbled upon a blog post (and two others) that contained the exact same image. The posts were all written in July of 2009 (which explains the distribution of the answers) about the Ruder-Finn Intent Index on Why People Go Online. Links to the original chart on the www.ruderfinn.com site were no longer valid, but after a little more searching I found a different version (written in Flash) at www.intentindex.com, which enables one to experience the chart animations and interactivity.

With the knowledge that a D3 version of this chart didn't exist, I decided that a good exercise (and the basis for this series of blog posts) would be to try to replicate the look of the Ruder-Finn Intent Index. I could then use it to come up with a chart that would better fit my own data.

Searching through D3 samples online, I came across a Radial Bar Chart which I felt was a good starting point. This contained many of the elements that I would need to replicate the Ruder-Finn Intent Index chart, such as the gridlines, radiating bars and a simple, but effective, animation.
 


Based on that code, I was able to piece together the above background for my chart. Nothing really groundbreaking, but a decent replica of the Intent Index chart.

In Part 2 of this series, I'll add the question gridlines and bars within each category. In Part 3, I'll add the category and question labels.

For a complete listing of the code and a working example, check out the Plunker: