Using a reference line as a divider between 2 shape marks
Updated: Jul 21, 2018
I recently released a viz analysing the 2018 F1 World Championship.
As part of the visualisation I visualised the individual standings for each of the drivers; when designing the viz I wanted to ensure the driver standings were represented visually, rather than a table of numbers. The method I chose to achieve this visual representation of each driver was through the use of 2 images (using the shapes marks card):
Image 1 - The helmet; in F1 the driver helmets are a distinctive design, unique to each driver
Image 2 - The national flag of the driver
Ideally I wanted to place the 2 icons alongside each other, with a thin line between the 2 icons but not between each driver, as depicted below:
When attempting to create the above design I found myself needing to use a Tableau hack to create the line between the icons; using a reference line as a column divider, here is how!
Step 1 : Create 2 marks cards for each driver
This step is a well known Tableau technique, using a '0' value to create marks on a viz. By assigning 2 x '0' pills to each driver I effectively allowed Tableau to place the 2 images alongside each other.
Step 2 : Change the marks type to shape
Having created the 2 pills I changed the marks card for both pills to shape; placing driver name on the shape for pill 1 and driver nationality on the shape for pill 2.
Step 3 : Placing a reference line to act as the divider between the 2 shapes
Time for the hack; because I only wanted a line between the 2 images and not between the drivers I couldn't use Tableau Line formatting to achieve this. The 2 shapes were not separate dimensions and as such the Column Line Divider formatting options were not sufficient.
To get around this I removed all of the lines and grid lines from the worksheet and fixed the axis ranges of both pills from -1 to 1 (basically setting the shape in the middle of the axis for each pill).
The last part of the hack was to use a constant reference line, on the first pill and to set the value of this reference line to 1. This created the illusion of there being a dividing line between the 2 shapes, exactly what I was trying to achieve.
To finish the driver standing part of the viz I created a secondary worksheet to place under the images, with this worksheet containing all of the text relating to the drivers; driver name, race points, race wins and race podiums.
The full viz is shown below: