# Use Radar Charts to Compare Dimensions over Several Metrics

04 Ago, 2015

Note: The following is a guest post by Jonathan Trajkovic.

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!

## Comentarios

Submitted by Chris Mace (no verificado) on

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.

Submitted by Leon Lu (no verificado) on

Hi Johnathan,
This is a great post! Really helpful.
What if the [Value] is not in the same scale? How do I change them into one scale? by Normalization?
Thanks!

Submitted by Tolga Coban (no verificado) on

Why can't Tableau do the math for me and offer a Radar / Spider Chart? I still don't get it.

Submitted by Shannon (no verificado) on

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.

Submitted by Andres (no verificado) on

This is a great great post. I'm trying to replicate it using 5 dimensions but I am not able to "replicate" the polygon when I assign "path to follow" on the very last step.

Any suggestions where I might be mistaken?

Thanks a lot

Submitted by Jose (no verificado) on

Submitted by Animesh C. on

Hi,

I recently tried to replicate this radar chart for 12 members. I have following suggestion for someone who is trying to do the same:

Logic provided:
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

Small Correction is however required

Correct Logic:

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 5" then [Value] *(sqrt(3)/2)
when "Member 6" then [Value] *(1/2)
when "Member 7" then 0
when "Member 8" then [Value] *(-1/2)
when "Member 9" then [Value] *(-sqrt(3)/2)
when "Member 10" then [Value] *(-1)
when "Member 11" then [Value] *(-sqrt(3)/2)
when "Member 12" then [Value] *(-1/2)
end

I hope this helps.

Submitted by Ryan Stimson (no verificado) on

Do you simply add these formulas into a new calculated field? I'm unsure where exactly to begin setting these up.

Also, what should I be putting in for the [Value] placeholder?

Submitted by David M. on

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

Submitted by David M. on

However, just like Andres, I stumbled on the last step. In my case the Polygon doesn't follow the order.
Any help is appreciated.

Submitted by David M. on

Never mind, I figured it out, they values have to be in alphabetical order.

Submitted by batben (no verificado) on

Thanks for posting this solution. Helped me very much!

Submitted by Edwin E. on

Thanks very much!. Helped me

Submitted by Brian Halloran (no verificado) on

David, wherever you are... you are beautiful. You just saved me A LOT of time!

Submitted by Bipin (no verificado) on

Hi Jonathan,

I am new to tableau. came across a requirement to create radar chart. I am able to create in excel.
Data as 9 measures and I want to create radar chart. Do you have any sample example for this?