Use radar charts to compare dimensions over several metrics

Radar charts are a great way to compare members of a dimension in a function of several metrics. For example, when you want to buy a smartphone, you can use a radar chart to compare several devices across several metrics like battery life, camera quality, and memory capacity.

Here’s how to create a radar chart in Tableau.

Trigonometry, my best friend ever!

To create a radar chart, we have to use trigonometry formulas—you remember the circle with Pi, and numbers, and stuff like that?

The exact formula you need depends on the number of metrics you want to display. For example, if you want to display five axes (= five metrics), your formula will differ from the one you use for a six-axis chart. In my case, I used a 12-axis chart, so I had to use several formulas as seen in the image above.

Thanks to the Internet, I was able to find the different formulas to create calculations in Tableau for the X axis and the Y axis. Here’s what they look like:

Calculation for [Xaxis]

case [Dimension]
when "Member 1" then 0
when "Member 2" then [Value] *(1/2)
when "Member 3" then [Value] *(sqrt(3)/2)
when "Member 4" then [Value]
when "Member 4" then [Value] *(sqrt(3)/2)
when "Member 5" then [Value] *(1/2)
when "Member 6" then 0
when "Member 7" then [Value] *(-1/2)
when "Member 8" then [Value] *(-sqrt(3)/2)
when "Member 9" then [Value] *(-1)
when "Member 10" then [Value] *(-sqrt(3)/2)
when "Member 11" then [Value] *(-1/2)
end

Calculation for [Yaxis]

case [Dimension]
when "Member 1" then [Value]
when "Member 2" then [Value]*(sqrt(3)/2)
when "Member 3" then [Value]*(1/2)
when "Member 4" then 0
when "Member 5" then ([Value])*(-1/2)
when "Member 6" then [Value]*(-sqrt(3)/2)
when "Member 7" then [Value]*(-1)
when "Member 8" then [Value]*(-sqrt(3)/2)
when "Member 9" then [Value]*(-1/2)
when "Member 10" then 0
when "Member 11" then [Value]*(1/2)
when "Member 12" then [Value]*(sqrt(3)/2)
end

It is very important to have the same [Value] scale for each [Dimension] member. Indeed, the 12 axes have to be the same. In my case, the scale was from 0 to 100.

Build the radar to detect everything

After the calculations comes time to build the chart. To do this, I just have to drag and drop the [Yaxis] on the rows shelf and the [Xaxis] on the columns shelf.

Note that I use the aggregation average (because sum will return the wrong results). Here, I have only one point.

To create the radar, I have to use several dimensions—in my case, [Country] and [IndexType]. The [IndexType] dimension allows me to draw 12 axes because this is a dimension with 12 members. The [Country] dimension allows me to draw one radar by country.

If I want to draw the average radar chart, I can remove the [Country] field. To have several points, I add [IndexType] on the Mark shelf as a Level of Detail.

Then I can change the Mark to draw a polygon and add [Country] as a quick filter.

The last steps involve assigning [IndexType] as a path to follow, and fixing the axis between -110 and 110 (or whatever range you’d like to set to provide enough space between the borders and the chart).

Some formatting, and voilà!

In my case, I made a few tweaks for the sake of design. I chose to remove the grid lines, the zero lines, and the borders. I hid the headers. At the same time, I added a border to my polygon and made the color more transparent.

Finally, I drew a background image to have a reference axis. I think it is better if you know where the maximum is.

To style the tooltip, it is important to put AVG([Value]) on the Mark shelf and to configure the tooltip like this:

And voilà! The radar chart is done!

Das könnte Sie auch interessieren ...

Kommentare

Submitted by Chris Mace (nicht überprüft) on 6 August, 2015 - 01:46

Hi Johnathan, a very interesting post, thank you.
I noticed that you have two number 4 members in the x axis calculation which is probably just a typo. Also it would be great if you could overlay the trigonometry diagram with the member numbers so we can see which position each formula relates to.
One last idea this gives me is to add in a label for each point / member as just looking at the shape you cannot tell what is doing better than another unless you then go an hover over each point. This would not work for the overview chart but you could then use this as a filter action for a bigger version.

Thanks for this post- very helpful! I have a stupid question: when adding the background image, how do you calculate the X and Y bounds of the background image? When I enter the x- and y-coordinates based off of my template (-1.1, 1.1) and (-1.1, 1.1), they do not line up correctly.

You don't have to precompute all those sines and cosines.
Let Tableau do it. E.g. for 10 values:
Calculated field x:
case [Dimension]
WHEN 'Value1' then SIN(0)
WHEN 'Value2' then SIN(2*PI()/10)
WHEN 'Value3' then SIN(2*2*PI()/10)
WHEN 'Value4' then SIN(3*2*PI()/10)
WHEN 'Value5' then SIN(4*2*PI()/10)
WHEN 'Value6' then SIN(5*2*PI()/10)
WHEN 'Value7' then SIN(6*2*PI()/10)
WHEN 'Value8' then SIN(7*2*PI()/10)
WHEN 'Value9' then SIN(8*2*PI()/10)
WHEN 'Value10' then SIN(9*2*PI()/10)
END

and the same for y just replace SIN with COS.
And then you can use it for multiple measures. Simply create
MeasureX = Measure * x
MeasureY = Measure * y

Hi David,
Thank you for your great insight. Is it possible to put down more details around how you can use this methodology for multiple measures? Do you have an example to share, please?
Thank you in advance!

Thank you for posting your example. This is very great!
Do you have any points on how to display two or more measures on the same axis chart? I'm not sure if it's even possible with Tableau spider chart work-around, but this is so easy in excel. How would I go about if I want to display the same measure but for different time periods on the same chart? What if I need to display a measure and a target/benchmark for comparison on the same spider chart? Any help will be greatly appreciated!

I think most people would agree that Tableau is not the best tool to create spider charts :).
If you really need them, perhaps you can use excel?
I know I'm not being helpful :), but the only reason I created that chart in the first place is because our business partners were so enamored of them. In the end we didn't use it, and I moved on to do other things, I haven't touched it since.
David

Hi Jonathan,
Thanks for sharing the details steps.
I am building a radar chart for 11 parameters.
Everything work fine. but my first parameter is on (0,1) coordinate.
All the data on first parameter are now plotted at the center of the radar. The rest 10 parameters are fine.
I have been finding different sources but yet to find solution.
I shall be very grateful if you could advise.
Thanks
Aung Myat