Creating a Radial Bar Chart In Tableau

by Tim Ryan

In this tutorial I will be going over how to make a radial bar chart. This chart type is very visually appealing and whilst it may not be the best way of clearly displaying the data, it will get people looking at the chart.

Introduction

I found out about this technique when I was looking for some cool custom tableau charts, the technique was developed by Rajeev Pandey who makes a lot of cool visual designs in tableau. I wanted to write this blog as a way of reinforcing my own learning as well as helping other to build this really cool chart.

Whilst the chart is called a radial bar chart, it doesn’t use the bar chart at all to make it. Instead it using some calculations and some trigonometry to plot points around a circle. We plot 2 points, one which is fixed as the inner point of the circle, the other point is calculated using the size of the measure we want to size the ‘bars’ and this is plotted as the outer point. Then we can use the ‘path’ section of line charts in tableau to join the dots together with lines, this is what forms the ‘bars’.

The Data Prep

I will be using Default superstore data that comes default with tableau in my radial bar chart.

Start by unioning the superstore data to itself by taking the orders table which we are using and dragging it on top of the orders table already in the data pane, this should bring up a box that says drag table to union, drop it on there and you will have unioned the orders table to itself.

This will make a couple of new columns ‘Sheet’ and ‘Table Name’. If you change the number of rows to be about 15000 and scroll down the ‘Table Name’ column you will see that the fields change from ‘Orders’ to ‘Orders$’ this is the sign that we have two different tables, so we know we’ve done the first step properly.

Next step is to mark one of these tables as the data which forms the startpoint of a line and the other one to be the endpoint of the line. Do this with a calculation that looks something like this.

The Calculations

Now go into a sheet and we can start making some calculations, firstly change the start/end calculation you just made to be a dimension instead of a measure, do this my dragging the pill into the dimensions. We need to make 2 parameters, one to mark the starting points of the lines and one to mark the end points of the lines.

Both parameters should be floats, the end points should have a value of 1 and the start points should have a value of 0.5. These are multipliers which will be used to plot where the start and endpoints are in the view, these can be changed later if you want to give a different effect, but these are ok as starting values.

We then want to make a field which we can use in calculations later on, this is the field which contains the measure you want to determine the length of the lines, in our case we’ll use sales.

Now we want to make an angle calculation. This calculation looks down your table using the index function to give a form of ordinality, from this it calculates which angle tableau needs to plot each line at, it will look like this.

(INDEX()-1) * (1/WINDOW_COUNT(COUNT([Lines field]))) *2* PI()

Now we want to make lengths for the lines and tell how far away from the centre of the circle tableau should plot the inner and outer points. Basically what this calc is doing is first seeing if the point is at the start of the line and assigning it a value of zero, if not, it will calculate where the end point should be by using the field we put in which was sales. The bit at the end helps to normalise the line lengths.

[Start points] + IIF(ATTR([Start/end])=0,0, SUM([Lines field])/WINDOW_MAX(SUM([Lines field]))* ([End points]-[Start point]))

Next we want to calculate the point on the X axis where we want to place the start and end points, to do this we use a trigonometry function in tableau (COS)

We also want to calculate the point on the Y axis where we want to place the start and end points, we do this in a similar way, but with a different function, the SIN function.

Putting Everything into the View

Now we have all the calcs needed for the chart to start taking shape. The first step in making the chart is to change the chart type to be a line and drag the [Start/end] dimension onto the path shelf. Next drag the [Line X] and [Line Y] pills onto the columns and rows respectively. Your view will now look like this, its still a bit broken but we’re about to fix that.

Now we need to add what we want to break up the view by onto the detail shelf, in this instance we’re going to break it up by customer name, so we can drag customer name onto the detail shelf. Then we want to edit the table calculations on the Line X and Line Y by clicking on the little arrows on the right hand side and compute using customer name, or whatever you put on the detail shelf.

And there you go, you have a nice radial bar chart which looks really cool. You also probably have a lot of white space in the middle of the chart (depending what value you have in your start points parameter) which you can put some additional information, I’m going to put some BANs in just to make it look nice on a dashboard.

And there you have it a nice radial bar chart which will hopefully make your dashboard look really cool and will hopefully make the audience of your dashboard more engaged with the data you’re displaying.

If you use the tutorial in making any cool dashboards or find some other cool uses for the calculations, be sure to let me know. I can be found on twitter @thenumberstim.

Until then, cheers for reading, have a good one!