Modulo: How to Add Multiple Shapes to Line Charts in Tableau

by Henry Mak

As described in my previous blog post, the method used is an application of the modulo operator.

A reason why you want to make this type of chart might be to make the chart more accessible. One user who may find it useful is someone who has impaired vision. This can be very helpful for them to distinguish between different lines, especially if the data points are close together.

Below is what the chart looks like without the shapes. This chart is describing the cumulative number of first and second doses of COVID-19 vaccines in the UK. The blue line is for first doses and the yellow line is for second doses. This is achieved via a synchronised dual axis chart.

The method that we will be using will also utilise the Dual Axis function but instead it will use Measure Values and Measure Names.

Here's how I achieved the final product:

1. Create a calculated field called 'First Dose'.  

What this calculation does is that it will extract the data points for the shapes from the first dose data. In this calculation, it extracts a data point every seven days.

2. Create a similar calculation called 'Second Dose'

This follows the same logic as the first calculation but this will help us create the shapes for the second dose line.

3. Place Date (continuous) onto the columns and place Measure Values onto the Rows, twice. Remove all the other Measure Values from from the 'Measure Values' card and keep only 'First Dose' and 'Second Dose'. Dual Axis these charts and synchronise the axis.

4. Change the Marks card for the second Measure Values from 'Automatic' to 'Shape'.

5. Ensure that Measure Names are under 'Colour' and 'Path' for the first Measure Values marks card. Similarly, ensure that for the second Measure Values marks card 'Measure Names' is under 'Colour' and 'Shape'.

This is what the chart should like after following these steps.

Format as necessary and here is the final product. Enjoy!


Link to all of my other blog posts on the Modulo operation

Tableau Public

Twitter

LinkedIn