One of the most read tutorials on Tableau Magic is my Radial Bar Chart Tutorial. As more Tableau enthusiast check out our website, we are getting more requests for a tutorial on how to draw a Squared Radial Bar Chart, so therefore, I hope you enjoy this tutorial for creating a Squared Radial Bar Chart, and an added bonus to being able to set the starting angle.

Note: As always never choose a data visualisation type and try to fit your data into it, instead, understand your data and choose the best visualization for your data consumers.

Data

Load the following data into Tableau Desktop / Public.

CountryPathValue
United States0400
United States201400
United Kingdom0300
United Kingdom201300
France0250
France201250
Germany0220
Germany201220
Canada0120
Canada201120

Note: we need two records for each Country as we are going to be drawing lines and using densification to get more points on our canvas. For more information, check out our article of Data Densification.

Calculated Fields

With our data set loaded into Tableau, we are going to create the following Calculated Fields, Bins and Parameters:

Path (bin)

  • Right click on Path, go to Create and select Bins…
  • In the Edit Bins dialogue window:
    • Set New field name to Path (bin).
    • Set Size of bins to 1.
    • Click Ok.

Distance from Center

Create the following parameter with:

  • Set Name as Distance from Center.
  • Set Data type as Integer.
  • Set Current value as 3.
  • Set Allowable values as Range.
  • Set Minimum as 3.
  • Set Maximum as 10.

Starting Degree

Create the following parameter with:

  • Set Name as Starting Degree.
  • Set Data type as Integer.
  • Set Current value as 45.
  • Set Allowable values as Range.
  • Set Minimum as 0.
  • Set Maximum as 360.
  • Set Step size as 15.

Index

INDEX()-1

TC_Value

WINDOW_MAX(MAX([Value]))

TC_Max Value

WINDOW_MAX(SUM([Value]))

TC_Percentage

[TC_Value]/[TC_Max Value]

Rank

RANK_UNIQUE([TC_Value],"asc")

X

IF [Index] <= 100 THEN
    SIN(RADIANS([Index]*2.7*[TC_Percentage]+[Starting Degree]))
    *([Rank]+[Distance from Center])
ELSE
    SIN(RADIANS((201-[Index])*2.7*[TC_Percentage]+[Starting Degree]))
    *([Rank]+[Distance from Center]+1)
END

Y

IF [Index] <= 100 THEN
    COS(RADIANS([Index]*2.7*[TC_Percentage]+[Starting Degree]))
    *([Rank]+[Distance from Center])
ELSE
    COS(RADIANS((201-[Index])*2.7*[TC_Percentage]+[Starting Degree]))
    *([Rank]+[Distance from Center]+1)
END

Let us explore X and Y a little.

  • The IF Statement allows us to draw the inner line of the shape if Index Table Calculation is less than or equal to 100, otherwise, draw the outer line of the shape.
  • The Outer line of the shape has additional distance from the centre, hardcoded to 1.
  • 2.7 is required as a multiplier as we want our Radial Bar Chart to be a maximum of 270 degrees.
  • The sole difference between X and Y is the use of COS or SIN.
  • We multiply by TC_Percentage so that the maximum value goes to 270 degrees, and everything else will be a percentage of that value.

So now that we have created a lot of Calculated fields, we will now put this together into a Worksheet.

Worksheet

We will now build our worksheet:

  • Change the Mark Type to Polygon.
  • Drag Path (bin) to Columns.
    • Right-click on the object, and ensure that Show Missing Values is checked.
    • Drag this object onto the Path Mark.
  • Drag Country onto the Detail Mark.
  • Drag TC_Value onto the Tooltip Mark.
    • Right-click on the object, go to Compute Using and select Path (bin).
  • Drag X onto Columns.
    • Right-click on the object, go to Compute Using and select Path (bin).
  • Drag Y onto Rows.
    • Right-click on the object, go to Compute Using and select Path (bin).

If all goes well, you should see the following:

Note: These are the moments that completely distract me while blogging and make me want to experiment with different and cool shapes.

We will edit the Table Calculations to adjust the visualisation:

  • Right-click on X and select Edit Table Calculation.
    • In Nested Calculations select TC_Max Value, and
      • In Compute Using select Specified Dimensions.
      • Ensure that Country and Path (bin) are both selected and Country is on top.
      • For At the level select Deepest.
    • In Nested Calculations select Rank, and
      • In Compute Using select Specified Dimensions.
      • Ensure that Country is the only value selected.
  • Right-click on Y and select Edit Table Calculation.
    • In Nested Calculations select TC_Max Value, and
      • In Compute Using select Specified Dimensions.
      • Ensure that Country and Path (bin) are both selected and Country is on top.
      • For At the level select Deepest.
    • In Nested Calculations select Rank, and
      • In Compute Using select Specified Dimensions.
      • Ensure taht Country is the only value selected.
  • Lastly, Ctrl-drag TC_Value from Tooltip to Color.

If all goes well you should now see the following:

Now, adjust the cosmetics of the visualisation to ensure that we have the look and feel desired.

  • Remove Axis Headers.
  • Remove Grid and Zero Lines.
  • Remove Axis Rulers.
  • Add a White Borders.
  • Adjust the Tooltip.

You should now see the following:

Normally, this is where the tutorial would be completed, but I want you to:

  • Set the background color for this visualisation as None.
  • Copy the worksheet and rename to Background.
  • In the Background worksheet:
    • Remove TC_Value from the Color Mark and the Tooltip Mark.
    • Right-click on X and select Edit Table Calculation.
      • In Nested Calculation, select TC_Max Value and uncheck Country.
    • Right-click on Y and select Edit Table Calculation.
      • In Nested Calculation, select TC_Max Value and uncheck Country.
  • Click on Color and choose a shade of Grey.

If all goes well your Background worksheet should look like the following:

Hopefully, you can see where we are going with this. Drag both worksheets onto a dashboard and use the Layout Pane to resize and position your worksheets so that they are exactly the same size and perfectly overlap. If all goes well you should see the following:

And boom, we are now done, adjust the parameters for extra fun. I hope you enjoyed this tutorial and if in doubt, you can download the visualisation from Tableau Public here: https://public.tableau.com/profile/toan.hoang#!/vizhome/SquareRadialBarCharts/SquareRadialBarCharts

Summary

I hope you all enjoyed this article as much as I enjoyed writing it and as always do share the love. Do let me know if you experienced any issues recreating this Visualisation, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic.

If you want to learn more about Creating Bespoke Data Visualisations in Tableau, do check out our course on Udemy at https://www.udemy.com/course/creating-bespoke-data-visualisations-in-tableau

4 COMMENTS

  1. Hi Toan Hoang,

    Thanks for all the tutorials. I am following all of this, It is very helpful.

    Have question on this. In the Edit Table calculations, you have mentioned Edit Tablea calculations for ‘X’ twice. I think one is for ‘X’ and other is for ‘Y’. Please let know if this is correct?

    Right-click on X and select Edit Table Calculation.

  2. Toan,
    I really enjoy your examples. A couple comments…

    1) In Starting Degree parm, you’ve got a couple typos… (I notice the differences from what you published to Tableau Public)

    Set Current value as 45 (should be 180)
    Set Minimum as 3 (should be 0)
    Set Maximum as 10 (should be 360)

    2) For your Path values, what’s the significance of 201? In the future, could you explain why your data is structured in a particular way. I’d like to understand it better so I can automate the process in Tableau Prep.

    Again, great stuff… keep it coming!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.