For Makeover Monday this week I decided to try to mimic the original design, a radial bar chart. I had never built a chart like this before so wanted to give it a crack and felt that following it up with a blog would help cement my learnings. You can view and download my workbook from my Tableau Public.
Before I continue, I have to give credit to Toan Hoang and his blog which can be found here. There are several tutorials out there on how to build these charts, but this is the one I followed. Toan’s blog was written pre Tableau 10, so there were certain elements, such as the table calculation configurations, which were slightly different. Some of my configuration when building the charts seem to take a while to figure out so I wanted to document it here. My blog will provide a slightly more up to date walk through of how to build this chart.
Something else that I should note. These types of charts are not always the greatest for visualisation best practices, so this is something you should definitely consider when choosing to build one.
Step 1. Prep the data
Building this chart requires some quick data prep in order to plot the bars in a circle. I chose to do this in excel. First we want to duplicate the data and add a column called path. Path should have the value 1 and in this instance 259. The second number will represent how many degrees around the circle your maximum value will go, all other values will be calculated from this. The reason that I have 259 in my example, is because my maximum value is 72 and 72% of 360 degrees is 259.
You can work this out accordingly through some simple maths of 360 * YOUR MAX VALUE%. Of course you start to run into issues if your maximum value is over 100. This is where you start to run into limitations of this chart. You could pick a number between 0-360 and decide that this is where you want your maximum to sit, however, you then start to have some bars/circles that are disproportionate in length. If you are to use this chart I would recommend only using values that are scored out of 100 such as percentages or indexes.
Step 2. Set up calculations in Tableau
Path (bin)
We must create bins with a size of 1 for our path field. You can do this by right clicking on your path field and selecting create > bins. Creating these bins pads out the data and enables us to plot points in between 1 and our maximum and help build the curve. Once we’re building the chart, if we forget to show missing values we will have ended up taking a very long winded route to some bar charts.
Index
We use the index function to assign an incremental number to each row in our view. We need this as we cannot multiply by our bin numbers. This could also be achieved using the RANK() table calculation however, we will be making a field called Rank later so we’ll keep them separate. We’ll add -1 to our calculation so our index starts at 0. Leave the table calculation properties as they are.
Pi
We will need to multiple our index by Pi in order to start drawing our circle in some later calculations. To do this, we use a table calculation which represents Pi. Again, leave all the table calculation properties as default.
Maximum value in dataset
We need to have the maximum value in our dataset in every row of our data. To set this up we use the following calculation. Leave all properties untouched.
Max value for each country
To get the maximum value for each country, we use the same table calculation as above. The difference is how they’re configured. To get the max for each country, we need to drag country and the calculation onto the view. Right click on the table calculation and select, compute using cell. This will now give us the max for each country. You can see the difference below.
Step Size
Next we need to find the proportion to the maximum, as all of our lines will be relative to the maximum value in our data. This is achieved with some simple division.
Rank
Here comes our ranking calculation that we avoided earlier. We need this in order to rank our rings from smallest to largest. You could tinker with this if you wanted them ordered differently. You want this to be computed along country. You can set this up by default by clicking on the blue ‘default table calculation’ and changing compute by from automatic to country.
Y
We need our Y and X points in order to draw our lines. We must multiply by Pi and divide by 180 in both cases as the sin and cos functions take values in radians not degrees. This is how you achieve that conversion.
X
Step 3. Building the view
Before we start building our chart, we need to ensure our bins are showing all values. To do this, drag the path (bin) onto rows or columns (it doesn’t matter which) right click and select show missing values. We can now drag this back off the view. You need to make sure that you have done this in the same worksheet as you’re going to build your chart in otherwise the ‘show missing values will have reset.
Follow these steps: Drag out country to colour. Drag max value each name to label. Drag name to label. Set mark types to line. Drag path (bin).
Drag Y to columns, right click on Y. Compute using > path (bin).
Drag X to rows, right click on X. Compute using > path (bin).
You should now be at the stage where the view looks like the one below… do not fear, this is correct. We just need to edit our table calculations.
Follow these steps carefully! If you are on an old version of Tableau then your table calculation window will be different. I would recommend you looking at Tom Hoang’s blog.
Right click on Y. Select edit table calculations. Under the nested calculations drop down select max value. Select specific dimensions. Check the tick boxes for both path and country. Ensure that you have dragged path above country. Below this, make sure that ‘at the level’ is set to deepest.
Now choose rank from the nested calculations drop down. Select specific dimensions. Check the tick boxes for both path and country. This time ensure that country is above path. Select ‘at the level’ to be country.
Close the table calculation window
Right click on X. Select edit table calculations. Under the nested calculations drop down select max value. Select specific dimensions. Check the tick boxes for both path and country. Ensure that you have dragged path above country. Below this, make sure that ‘at the level’ is set to deepest.
Now choose rank from the nested calculations drop down. Select specific dimensions. Check the tick boxes for both path and country. This time ensure that country is above path. Select ‘at the level’ to be country.
If you’ve followed all these steps correctly, you should now see something that looks like the image below! (Your colours will be slightly different). Once you start playing around with some formatting you can achieve the design I submitted for Makeover Monday.
There are some great tutorials to follow which will give you slight variations on this, such as arrowheads at the end of the lines. This blog provides a more basic design but I hope you’ve found this useful in building your own great radial bar charts!