This is a Quick Tip on how to build a Shape Bar Chart in Tableau, so less reading and more jumping in. We are going to spend 5 minutes or less building our Shape Bar Chart in Tableau.

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 States10.9
United States1010.9
United Kingdom10.5
United Kingdom1010.5
Canada10.2
Canada1010.2

Note: we require path and duplicate lines for densification. See our tutorial on Data Densification for more information. Click here

Calculated Fields

We will start by creating the following calculated fields.

Path (bin)

  • Right-click on Path.
    • Go to Create, and select Bins…
    • In the Edit Bins window:
      • Set New field name to Path (bin).
      • Set Size of bins to 5.
      • Click OK.

Index

INDEX()-1

TC_Value

WINDOW_MAX(MAX([Value]))

TC_Color

IF [Index] <= WINDOW_MAX([Index])*[TC_Value] THEN
    1
ELSE
    0
END

Now that we have created our Calculated Fields, we will build our Worksheet.

Worksheet

Now that we have our Calculated Fields and Bin object, let us create our Worksheet:

  • Change the Mark Type to Shape.
  • Drag Path (bin) onto Columns.
    • Right-click on the object and ensure that Show Missing Values is selected.
    • Drag this object onto the Detail Mark.
  • Drag Index onto Columns.
    • Right-click on this object, go to Compute Using and select Path (bin).
  • Drag Country onto Rows.
  • Drag TC_Color onto the Color Mark.
    • Right-click on this object, go to Compute Using and select Path (bin).

If all goes well, you should see the following:

Now we need to get our Custom shape image, download the following image HERE, and save this into the following directory: My Tableau Repository\Shapes\Custom Shapes.

Note: Create the Custom Shapes folder, or name this whatever you fancy.

Now apply this new Shape:

  • Click on the Shape Mark and More Shapes.
  • Click on Reload Shapes.
  • In Select Shape Palette select Custom Shapes
    • Click on the image and apply this to your Data Item.
    • Click Ok.

You should now have the following:

Now we want to edit the Cosmetics:

  • Hide the Index Header.
  • Hide Field Labels from Rows.
  • Hide Zero Lines.
  • Edit the Sort Order.
  • Edit the Tooltips.
  • Edit Fonts.
  • Edit Sizes.

You want to end up with the following:

and boom, we are done with this Quick Tip. You can find my Shape Bar Chart on Tableau Public at
https://public.tableau.com/profile/toan.hoang#!/vizhome/ShapeBarCharts/ShapeBarCharts

Extra Credit:

  • Change the value of Path (bin) to add or remove the number of segments.
  • Use your own Custom Shapes.

Summary

I hope you all enjoyed this article as much as I enjoyed writing it. 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

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.