Using the new Tableau version 2020.1 onwards.
To build a bar chart race is to create many discrete pages of bar charts and then string them together, just like how a traditional cartoon animation is built.
In Dec 2019, Tableau released 2020.1 beta version with a new Animations feature for dynamic parameters. This means that the bar chart race below is now very easy to build.
Watch it in action: https://www.youtube.com/watch?v=3iZrMkZ3948
Download and install Tableau Public (latest version 2020.1.2 onwards). It is free of charge with full functionality. The only snag is that any work done can only be published on the Tableau Public server, and not saved locally to your Desktop. This is alright if the data is not sensitive or private.
Download the latest COVID-19 data (in *.xlsx format) from the European Centre for Disease Prevention and Control website, and rename it using a generic filename “COVID-19-geographic-distribution-worldwide.xlsx”. You can replace this file with the updated data later, using the same filename.
Open the Tableau Public app, and connect to the downloaded data file (click on “Microsoft Excel”). Click on the “Sheet 1” tab at the bottom left.
There are 2 useful quantities you can choose to race in this dataset:
To choose the race quantity as daily infected cases:
To label the bar chart with country names:
To have the bars in various colours:
This section requires a simple programming line of code.
RANK_UNIQUE(Sum([Cases]))
To create a snapshot of animation frames:
Turn on animations:
To set the transition duration:
Look for a little Animations control which appeared when the animations feature is turned on, and click the “forward play” icon. Drag the slider bar to a different date or use the left/right button to choose a date.
1. To improve colours:
Click on Label → ensure “Show mark labels” is checked.
Click on Colour → Edit Colours -> replace similar colours if any.
(I have replaced the colours for USA, Spain, Italy)
Hide the Countries legend card, no need for it anymore.
2. To add additional labels for the number of cases to the bars:
Drag “Cases” to Label.
Click on Label → Text → click on “3 dots”. This opens up the label editor.
Arrange labels to 1 line only.
Underline <Countries And Territories>.
Bold <SUM(Cases)>, and use red font.
Click on “OK”.
3. To change sheet name:
Double-click on “Sheet 1”, and change it to “COVIT-19 Daily Infected Cases”.
4. To change X-axis limits:
Double-click on the X-axis, this brings up the Axis menu.
Choose Range to be “Fixed”, Fixed start=0, Fixed end=40,000.
5. To display only the top 15 countries:
Drag “Rank” to Filters → click on “OK”.
Click on (Filters) Rank → drop down menu → Compute Using → “Countries And Territories” .
Replace “206” with “15”, and click on “OK”.
Change the Standard view to “Fit Height”.
6. To increase label font size:
Click on Label → Font → drop down menu → change to font size “15”.
7. To add date label on chart:
Right-click on the empty chart area → Annotate → Area.
This brings up the annotation editor.
Key in <Page Name>, and increase font size to “20”.
Click on “OK”.
The date label is created. Resize and locate it at the bottom.
When you are satisfied with the customisation, the visualisation is then ready to be published.
Click on File → Save to Tableau Public.
The work is now published on the Tableau Public server. You can then share it using the available link.
Here’s a video tutorial with step-by-step guide for the entire process:
Let your creativity flow!