Two weeks ago, we released our Spiral Column Chart Tutorial in Tableau using the Line Mark Type. In this tutorial, we are going to create a Squared version using the Polygon Mark Type, so I really hope you enjoy this.

Note: This is an alternative type of data visualisation, and sometimes pushed for by clients. Please always look at best practices for data visualisations before deploying this into production.

Data

We will start by loading the Sample Superstore data into Tableau Desktop / Tableau Public.

Note: If you have Tableau Desktop, you can use the Sample data source, but if you are using Tableau Public, download and load the following data source.

Once your data is loaded into Tableau, right-click on the data source and click on Edit Data Source… with the Data Source Editor open, paste the following:

Path
1
4

Note: If you are using Tableau 2020.2 or great i.e. have access to new Relationship Model, you will need to double-click on the originally pasted data source to open up before pasting in the Path Data.

You should get an error as there is no joining column, however, click on Add new join clause, go to Create Join Calculation, type 1 and click OK. Do this for the right-hand side as well. Ensure that you have Inner join selected and you should see the following:

Note: we need additional records 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 on Data Densification.

Calculated Fields

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

Size Parameter

  • Set Name as Size.
  • Set Data type as Integer.
  • Set Range of values as Range
    • Set Minimum as 1
    • Set Maximum as 10
    • Set Step size as 1
  • Set Current value to 4

Growth Parameter

  • Set Name as Growth.
  • Set Data type as Float.
  • Set Range of values as Range
    • Set Minimum as 0.5
    • Set Maximum as 5
    • Set Step size as 0.25
  • Set Current value to 1

Bar Size Parameter

  • Set Name as Bar Size.
  • Set Data type as Float.
  • Set Range of values as Range
    • Set Minimum as 0.5
    • Set Maximum as 5
    • Set Step size as 0.25
  • Set Current value to 3

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

Index

(INDEX()-1)*[Size]

Index (Bar)

INDEX()-1

TC_Sales

WINDOW_MAX(SUM([Sales]))/2

TC_Max Sales

WINDOW_MAX(SUM([Sales]))/2

TC_Percentage

[TC_Sales]/[TC_Max Sales]

TC_Starting Point

10+([Index]/100*[Growth])

X

IF [Index (Bar)] = 0 THEN 
    SIN(RADIANS([Index]))*[TC_Starting Point]
ELSEIF [Index (Bar)] = 1 THEN 
    SIN(RADIANS([Index]))*([TC_Starting Point]+([TC_Percentage]*[Bar Size]))
ELSEIF [Index (Bar)] = 2 THEN 
    SIN(RADIANS([Index]+[Size]))*([TC_Starting Point]+([TC_Percentage]*[Bar Size]))
ELSE
    SIN(RADIANS([Index]+[Size]))*[TC_Starting Point]
END

Y

IF [Index (Bar)] = 0 THEN 
    COS(RADIANS([Index]))*[TC_Starting Point]
ELSEIF [Index (Bar)] = 1 THEN 
    COS(RADIANS([Index]))*([TC_Starting Point]+([TC_Percentage]*[Bar Size]))
ELSEIF [Index (Bar)] = 2 THEN 
    COS(RADIANS([Index]+[Size]))*([TC_Starting Point]+([TC_Percentage]*[Bar Size]))
ELSE
    COS(RADIANS([Index]+[Size]))*[TC_Starting Point]
END

With this done, let us start creating our data visualisation.

Worksheet

We will now build our first worksheet:

  • Drag Order Date onto the Filter Shelf and filter for 2018
  • Drag Order Date onto the Detail Mark
    • Right-click on this pill and select Exact Date
  • Drag Path (bin) onto the Columns Shelf
    • Right-click on this pill and ensure that Show Missing Values is selected
    • Drag this pill onto the Detail Mark
  • Drag X onto the Columns Shelf
    • Right-click on this pill, go to Compute Using and select Order Date
  • Drag Y onto the Rows Shelf
    • Right-click on this pill, go to Compute Using and select Order Date

If all goes well, you should now see the following:

We will now edit the Table Calculations and build our polygons:

  • Right-click on the X pill and select Edit Table Calculation
    • In Nested Calculation select Index (Bar)
      • In Compute Using select Specific Dimensions and select Path (bin)
    • In Nested Calculation select TC_Sales
      • In Compute Using select Specific Dimensions and select Path (bin)
    • In Nested Calculation select TC_Max Sales
      • In Compute Using select Specific Dimensions and select Order Date and Path (bin)
      • Ensure that Order Date is on top

We will repeat this for the Y pill:

  • Right-click on the Y pill and select Edit Table Calculation
    • In Nested Calculation select Index (Bar)
      • In Compute Using select Specific Dimensions and select Path (bin)
    • In Nested Calculation select TC_Sales
      • In Compute Using select Specific Dimensions and select Path (bin)
    • In Nested Calculation select TC_Max Sales
      • In Compute Using select Specific Dimensions and select Order Date and Path (bin)
      • Ensure that Order Date is on top

Lastly:

  • Change the Mark Type to Polygon
  • Drag Path (bin) onto the Path Mark

You should now see the following:

Now we will adjust the cosmetics:

  • Hide the Zero Lines
  • Hide the X-Axis and Y-Axis Headers
  • Hide the Grid Lines
  • Adjust the Colors
  • Adjust the Tooltips

You should now have the following:

Note: Try adjusting the parameters, and also the TC_Starting Point calculated field

and boom, we are done! I hope you enjoyed creating this data visualization and learned some cool techniques as well. As always, you can find this data visualisation on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/SquareSpiralColumnCharts/SquareSpiralColumnChart

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 Visualization, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic. Do also remember to tag me in your work if you use this tutorial.

Also, do be sure to check out our various courses:

6 COMMENTS

  1. Hi Toan Hoang,

    Very good tutorial! However, I was stuck at the “Edit Table Calculation” for X and Y. There is no Index (Bar) for the dropdown options. And are we supposed to select three different Nested Calculations for both X and Y? I believe we can only select one option at a time. I hope you could advise me on this. Recently knew about your blog and really love it!

    Duy Nguyen

  2. Hi Toan, I’m sure I must be missing something but when I do these last two steps:

    “Lastly:

    Change the Mark Type to Polygon
    Drag Path (bin) onto the Path Mark”

    Everything goes blank and all the marks and polygons disappear.

    Could use some help.

    I’m using the latest Tableau Desktop version

      • Hello, Thanks for the prompt reply, I’ve managed to sort it out in the mean time. For some reason the join calculation was reverting to the Path field and not accepting the 1.

        I had to remove and paste the path create the join calculation again and now it works.

        On another note, if I wanted to leave a gap between bars, or remove 0 from the axis so that the difference between the bars is more noticeable, how would I go about it?

        Regards,

        Jorge

Leave a Reply

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