Toan Hoang

Gauge Chart (With Arrow)

As of the time of this article, I am a two-time Tableau Zen Master, and, as such, I am afforded several different types of opportunities from Tableau. One such opportunity is to volunteer as a Tableau Doctor at the Tableau Conference, which is where attendees can book a 20-minute session with us to help diagnose an issue and provide an answer; it was at one of these Tableau Doctor sessions that I was asked to help create the Gauge Chart in Tableau. This tutorial is the find output, so I really do hope you enjoy it.

Note: This is an alternative type of data visualisation, and is 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.

Calculated Fields

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

Create a @Selected Year Parameter

Create a @Selected Year Parameter

IIF ([Ship Mode]="First Class", 0, 1)

Path (bin)

Index

INDEX() - 1

Sales (Selected Year)

SUM(IF YEAR([Order Date]) = [@Selected Year] THEN
    [Sales]
END)

Sales (Comparison Year)

SUM(IF YEAR([Order Date]) = [@Comparison Year] THEN
    [Sales]
END)

Sales (Growth)

( [Sales (Selected Year)] - [Sales (Comparison Year)] ) / [Sales (Comparison Year)]

TC_Sales Growth

WINDOW_MAX([Sales (Growth)])

TC_Angle Calculation

90 * // 100 % would be right down the middle

// This is here to make sure that insane growth can still be represented in this visualisation, we will have the label so you can see the actual numbers
IF [TC_Sales Growth] > 2 THEN
    2 // Set the maximum value of the line to 200%
ELSEIF [TC_Sales Growth] < 0 THEN
    0 // Set the minimum value of the line to 0%
ELSE
    [TC_Sales Growth]
END

TC_Sales Growth Label

IF [Index] = 0 THEN
    [TC_Sales Growth]
END

X

[Index] * COS(RADIANS([TC_Angle Calculation]))

Y

[Index] * SIN(RADIANS([TC_Angle Calculation]))

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

Worksheet

We will now build our worksheet:

If all goes well, you should see the following:

Now we will adjust the data visualisation:

If all goes well, you should now see the following

Lastly, we will now apply a background image to complete our data visualisation, so download the following image:

You should now see the following:

The last thing to do is to apply the final formatting touches i.e. removing gridlines and adjusting your fonts, but you will want to end up with something like this:

P.s. enable Animations and then change the Parameter values to really see some magic at work, I think you will like it,

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/app/profile/toan.hoang/viz/GaugeChartArrowIndicator/GaugeChartArrowIndicator

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.

Exit mobile version