Toan Hoang

Creating Curved Bar Chart in Tableau (Variation)

During my break periods, I used to post cool data visualisations that I have found on various websites, yes, I really browse a lot. One was a variation of my Curved Bar Chart, but instead of using the Sigmoid function, we are going to try something a little different.

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
0
100

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 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 on Data Densification.

Calculated Fields

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

Create a Distance Parameter

Create Path (bin)

Index

(INDEX()-1)/10

Region Index

INDEX()*[Distance Parameter]

TC_Sales

WINDOW_SUM(SUM([Sales]))/2

TC_Label

IF [Index] = 5 THEN
    [TC_Sales]
ELSE
    0
END

X

[Index]+[Region Index]

Y

IF [Index] < WINDOW_MAX([Index])/2 THEN
    EXP([Index])-1
ELSE
    EXP(WINDOW_MAX([Index]-0.1)-[Index])-1
END
* [TC_Sales]

Note, you can try different functions here, just for fun, experiment and let me know what you find.

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

Worksheet

We will now build our first worksheet:

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

We will now adjust the X Table Calculation:

If everything has gone well, your curved bar charts should not be more spaced out:

We will now add a line so that we can place a text label onto the data visualisation. Note: Labels and polygons really don’t mix well.

You should now see the following:

We will now finish off this data visualisation:

Basically, adjust as much as you fancy, but you want to have something like the following:

Try adjusting the Distance parameter and see what you can come up with. and now, we are done, you can find my data visualisation on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/CurvedBarChartVariation_15847377353000/CurvedBarChartVariation

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 like our work, do consider supporting us on Patreon, and for supporting us, we will give you early access to tutorials, exclusive videos, as well as access to current and future courses on Udemy: https://www.patreon.com/tableaumagic

Exit mobile version