Curvy Bump Chart
Are you left scratching your head over the title of this post and what it means? Well, so was I, until I had a use-case that was solved using the brilliant and rarely used Curvy Bump Chart. The use case was to visualize the ranking of different teams of the IPL Cricket tournament and to show their rise and fall over the years.
If I have pique your interest then keep on reading because I will not only be breaking down the simple concept behind the Curvy Bump Chart but will also be giving a thorough walkthrough on how you can recreate the chart yourself.
What is a Bump Chart?
To begin with, a Bump Chart shows how rankings change over time. This visualization is not only easy to understand, but also quick to create. In the following visual we are using a simple Bump Chart to easily and visually track the ranking of a team with a line that connects the team across the time periods.
Unfortunately, the Cons of the Bump Chart happen to be equally discouraging for it to be implemented. From the following visual, with the increase in the number of data points it gets really hard to keep a track of a team’s ranking over the years and the visual eventually looks busy with lines cutting across empty spaces.
In such case, a Curvy Bump Chart might be more visually appealing and also give more flexibility to present additional data attributes that a Bump Chart might not be successful at. Check out the above viz on Tableau Public https://public.tableau.com/app/profile/akruti.ambade/viz/IPLPlayoffs/Dashboard
This visualization and tutorial was inspired by Tableau Zen Master Toan Hoang’s tutorial where he has succinctly explained a rather complex visual.
Walkthrough
Get Data
Let’s start with some sample data of team performances over the years. Create an Excel spreadsheet and add the following data into a tab named Data
.
Year | Team | Score |
---|---|---|
1/1/2020 | Team A | 800 |
1/1/2020 | Team B | 500 |
1/1/2020 | Team C | 300 |
1/1/2021 | Team A | 600 |
1/1/2021 | Team B | 900 |
1/1/2021 | Team C | 200 |
1/1/2022 | Team A | 500 |
1/1/2022 | Team B | 400 |
1/1/2022 | Team C | 1000 |
Connect Data
Open up Tableau Desktop and connect to the spreadsheet in the Data Source
page. Once the connection is done, drag the Data
sheet from the left pane into the Canvas
. The Canvas
will now show the Data
table which is at the logical layer. Double-click on the Data
table to go to the physical layer of the canvas.
In this physical layer, we will be performing a Union of the data with itself. Now, drag the Data
sheet from the left pane again to the bottom of the Data
table until you see the Drag table to union
option visible. Once visible, release the sheet to complete the Union.
After this task is done, you will see the Data grid
showing the following result of the union along with two new columns added named Sheet
and Table Name
. The Table Name
column will have two unique values Data
and Data1
to showcase the two sets of data that are part of the Union.
Year | Team | Score | Sheet | Table Name |
---|---|---|---|---|
1/1/2020 | Team A | 800 | Data | Data |
1/1/2020 | Team B | 500 | Data | Data |
1/1/2020 | Team C | 300 | Data | Data |
1/1/2021 | Team A | 600 | Data | Data |
1/1/2021 | Team B | 900 | Data | Data |
1/1/2021 | Team C | 200 | Data | Data |
1/1/2022 | Team A | 500 | Data | Data |
1/1/2022 | Team B | 400 | Data | Data |
1/1/2022 | Team C | 1000 | Data | Data |
1/1/2020 | Team A | 800 | Data | Data1 |
1/1/2020 | Team B | 500 | Data | Data1 |
1/1/2020 | Team C | 300 | Data | Data1 |
1/1/2021 | Team A | 600 | Data | Data1 |
1/1/2021 | Team B | 900 | Data | Data1 |
1/1/2021 | Team C | 200 | Data | Data1 |
1/1/2022 | Team A | 500 | Data | Data1 |
1/1/2022 | Team B | 400 | Data | Data1 |
1/1/2022 | Team C | 1000 | Data | Data1 |
Plot Basic Sigmoid graph
Before we dive deep into the chart, we will create a basic sigmoid graph. A sigmoid function is a mathematical function whose graph has a characteristic S-shaped or sigmoid curve. The mathematical formula for a Sigmoid is as follows,
$$ \sigma(x) = \frac{1}{1 + e^{-x}} $$
Let’s create the following calculated fields to recreate the above Sigmoid function in Tableau,
IF [Table Name] = 'Data' THEN 1
ELSE 49
END
INDEX()-1
([Index]-25)/4
1/(1+EXP(-[T]))
Steps to create the basic sigmoid graph,
- Right-click on the
Path
field and then selectCreate
andBins...
. - In the
Edit Bins [Path]
pop-up menu, edit theSize of bins
to1
and selectOK
to close the menu. - Drag the newly created
Path (bin)
dimension onto the Rows shelf. - Right-click on the
Path (bin)
pill in the Rows shelf and make sure theShow Missing Values
option is selected. - In the
Marks
card, change the Mark Type selection fromAutomatic
toLine
. - Drag the
Path (bin)
pill from the Rows shelf into thePath
mark in theMarks
card. - Drag the
T
measure onto the Columns shelf, and right-click on the pill and selectCompute Using
>Path (bin)
. - Drag the
Sigmoid
measure onto the Rows shelf, and right-click on the pill and selectCompute Using
>Path (bin)
.
We now have created our basic Sigmoid graph, that resembles an S-curve. Here we have used the Data Densification technique to add more data points using the Path
dimension and the Show Missing Values
feature to create a smooth curve.
Modify Sigmoid Graph
Now we are going to use some math and modify the Sigmoid function to slightly change the appearance of the graph. Update the following two existing calculated fields,
IF [Table Name] = 'Data' THEN 1
ELSE 201
END
(-6+([Index]-151)*6/25)
With the update, we have added additional data points to elongate the tail on the bottom left-hand side and accommodate a rounded bar chart that will overlap on the curve.
Create Calculated Fields and Parameter
We are now stepping into advance level of this visualization, for which we will need to create the following,
Parameter
Create a parameter named Distance
with the Data type
as Integer
and Current value
as 19
.
Calculated Fields
LAST()
WINDOW_MAX(MAX([Score]))
WINDOW_MAX(MAX([Score]))
[Value]/[Max Value]*100
RANK_UNIQUE([Value],"desc")
LOOKUP([Current Position], 1)
IF [Index] < [Percentage] + [Distance] AND [Index] > [Distance] THEN 1
ELSE 0
END
IF [Last]=0 THEN 0
ELSE ZN([Next Position]) - ZN([Current Position])
END
IF [Index] < 151 THEN RANK_UNIQUE ([Value])
ELSE RANK_UNIQUE([Value]) + ([Sigmoid] * [Multiplier])
END
Create Ranked Rounded Bar Chart
We will now create a Ranked Rounded Bar chart for our visual to arrange the score as per Rank.
- In the Columns shelf, replace
T
withIndex
, and right-click on the pill and selectCompute Using
>Path (bin)
. - In the Rows shelf, replace
Sigmoid
withRank
, and right-click on the pill and selectCompute Using
>Path (bin)
. - Drag the
Year
dimension onto the Columns shelf, and right-click and make sure it is selected asDiscrete
. - Drag the
Team
dimension into theColor
section on theMarks
card. - Right-click on
Rank
in the Rows shelf, and go toEdit Table Calculations
- In the
Nested Calculations
dropdown, selectRank
. - Set
Compute Using
toSpecific Dimensions
. - Ensure that only
Year of Year
andTeam
are selected below. - Arrange the order to
Year of Year
at the top, andTeam
below that. - In the
Restarting every
menu, selectYear of Year
. - In the
Nested Calculations
dropdown, selectLast
. - Set
Compute Using
toSpecific Dimensions
. - Uncheck all options in the
Specific Dimensions
sub-menu below.
- In the
- Drag the
Size
measure to theSize
section in theMarks
card and,- Right-click on the
Size
pill and selectCompute Using
>Path (bin)
. - Right-click on the
Size
pill again and go toEdit Table Calculations
. - In the
Nested Calculations
dropdown, selectMax Value
. - Set
Compute Using
toSpecific Dimensions
. - Make sure to check only
Year of Year
,Team
andPath (bin)
. - Rearrange the order to
Year of Year
,Team
andPath (bin)
.
- Right-click on the
- Right-click on the
Rank
axis of the visualization and thenEdit Axis...
,- In the
Scale
section, select theReversed
option. - Close the
Edit Axis
menu.
- In the
In the above chart, the Teams are now properly ranked for each Year from top to bottom, with the length of the bar being a percentage of the Score compared to the Maximum Score in the dataset.
Create Curvy Bump Chart
Now that we have created the Sigmoid graph and Ranked Rounded Bar chart, we are going to link them up together to make our final visualization.
To combine them, Right-click on Rank
pill on the Rows shelf and go to Edit Table Calculations
- In the
Nested Calculations
dropdown, selectNext Position
.- Set
Compute Using
toSpecific Dimensions
. - Ensure that only
Team
andYear of Year
are checked. - Arrange the order with
Team
at the top.
- Set
- In the
Nested Calculations
dropdown, selectCurrent Position
.- Set
Compute Using
toSpecific Dimensions
. - Ensure that only
Team
andYear of Year
are checked. - Arrange the order with
Year of Year
at the top. - In the
Restarting every
menu, selectYear of Year
.
- Set
- In the
Nested Calculations
dropdown, selectLast
.- Set
Compute Using
toTable (across)
. - Close the
Table Calculation
menu.
- Set
We can additionally add custom shapes to the beginning of the bar chart to uniquely identify the teams. To achieve this,
- Create the following Calculated Field to represent team logos in the visual.
IF ATTR([Path]) = 1 THEN [Current Position]
END
- Drag the
Logo
measure to the Rows shelf and drop it next to theRank
pill. - Right-click on the
Logo
pill and go toEdit Table Calculations
.- In the
Nested Calculations
dropdown, selectCurrent Position
. - Set
Compute Using
toSpecific Dimensions
. - Ensure that only
Team
andYear of Year
are checked. - Arrange the order with
Year of Year
at the top. - In the
Restarting every
menu, selectYear of Year
.
- In the
- Right-click on
Logo
pill on the Rows Shelf and selectDual Axis
. - On the right of the visualization you will see an axis for
Logo
,- Right-click on the axis and select
Synchronize Axis
to align both the axes.
- Right-click on the axis and select
- Go to the
Marks
card section and open upLogo
mark card,- Remove the
Size
pill. - In the Mark Type dropdown selection, select
Shape
. - Drag the
Team
pill from the Logo mark card into theShape
, to change the Logo mark type to shape.
- Remove the
Although, it looks a bit messy, we have finally created a Curvy Bump Chart.
Cleanup
For our final step, we are going clean up the visualization.
- Right-click on the
Index
axis at the bottom and thenEdit Axis...
- In the pop-up menu, for the
Range
selectCustom
. - In the
Fixed start
set the value as -10. - In the
Fixed end
set the value as 200. - Adjust these two values accordingly until you see the line chart being seamless.
- In the pop-up menu, for the
- From the menu bar at the top select
Format
>Borders
- In the
Format Borders
menu that appears on the left selectColumns
at the top. - For the
Column Divider
section, setPane
toNone
.
- In the
- From the menu bar at the top select
Format
>Lines
- In the
Format Borders
menu that appears on the left selectSheet
at the top. - Set
Grid Lines
toNone
. - Set
Zero Lines
toNone
.
- In the
- Now hide the following two axes
- Right-click on the
Logo
axis and unselectShow Header
. - Right-click on the
Index
axis and unselectShow Header
.
- Right-click on the
And there you have it, a Curvy Bump Chart visualization. You can update the logos by uploading your custom shapes to the dashboard.
Summary
Ultimately, when it comes to visualization, there is no one-trick pony to help us present the data in the most visually-appealing and easy-to-understand manner. As per the use case, a simple Bump Chart might do the trick or an advanced time-intensive Curvy Bump Chart might. Eventually, the best one is the one that your customer easily understands.
So, stay curious and always keep on exploring.