The topic for the August 2021 round of #IronQuest was travel, which is something I’ve been passionate about over the years, so I was keen to submit an entry.
Thinking of topics and recent travels that might be interesting to visualise, I remembered an experimental travel related dashboard I made in 2019 that I didn’t end up publishing as the calculations didn’t work on Tableau Server at that time (related to using parameters in spatial calculations), but those calculations now work so, after retesting and a few minor modifications, I thought it would be a fun dashboard to share.
Purpose of the Dashboard
The dashboard enables the user to draw a connected path along points on a map to be able to plan out two different travel routes and then compare the total distance of those routes and also see the total approximate amount of carbon emissions for each, along with a breakdown by every leg of each journey based on the method of transport used.
Below is an image of the dashboard with the help overlay page showing:
The intended flow of events for using the dashboard is as follows:
- Click points on the map to draw out the route you want to take on trip 1
- At any point you can change the method of transport for the next leg of the journey using the icons on the right-hand side
- When the journey is fully mapped out, click the Save Trip 1 button at the top
- Click the Start Over button to clear the current journey
- Repeat step 1 to draw out a second, alternative trip
- Click the Save Trip 2 button to store those details
- Once you have saved two trips, a Compare button will appear. Click this button to see a comparison of both trips on a new page
The name of each location, the method of transport used to travel there and the (straight line) distance of each leg of the journey is shown in the lower-left chart. Waterfall charts in the lower-right of the dashboard show the distance and emissions for each leg of the journey.
Below is a speeded up animation of an example use case:
Below is a summary of some of the techniques used in the dashboard.
Drawing Points on a Map
The technique used to draw connecting dots on the map is something I wrote about at the time in this blog post, so I won’t cover this again here, however, more recently, I also created a presentation on the technique which you can find here.
Saving the Trips
With the introduction of parameter actions in version 2019.2, you are now able to populate a parameter with a value from your chart. This would usually be a measure or a dimension, however, you can also pass the value of one parameter to another parameter and that’s how this works. The main map uses four parameters that store delimited lists of the following:
- Point ID
- Transport method
There are four parameter actions that are triggered when you click either of the save buttons to store the above data in four different parameters. There’s an additional four parameter actions for the second save button to allow that trip to also be stored separately.
This is one of the calculations used to determine what is passed to the parameter for Trip 1. When clicking the Save Trip 1 button, the parameter values used in the main map are passed. If clicking the Save Trip 2 button, then the existing values saved for trip 1 are overwritten with the same values (i.e. no effect).
The Compare Button
This button only appears once two trips have been saved as there’s no point to go to the compare screen if there are no trips or only one trip saved. To achieve this, a filter calculation is used, filtered to True, that checks both parameters are not empty. The Compare button has a Go To Sheet action assigned to it that redirects to the second dashboard:
The compare buttons and the save buttons are custom shapes.
Below is the compare dashboard. This uses the same logic for drawing out the journey routes but uses the parameters that the journeys on the main map were saved to. On this page the user can compare the total distances, number of journey legs and carbon emissions used. Hovering over any journey leg will filter the charts.
Selecting a Transport Type
A small Excel file with the five transport types is used as a data source for this view, which is then used to send a value to another parameter. When a transport type is selected a small bar is shown next to the symbol to show it’s been selected. The bar is a regular bar chart that uses the below calculation to draw the value only for the selected item:
Below, you can see that the car method of transport is selected:
Go Back or Start Over Buttons
When drawing out a route on the map, if you make a mistake or just change your mind you can click the back button to remove the most recently added point. Or you can click Start Over to remove all points. This is done by overwriting the parameter storing the saved locations with a new value, determined by the below calculation:
There are similar calculations for each of the four parameters
The Journey Legs Chart
To show each leg of the journey with the transport type used and the (straight line) distance between each location, the below view is used:
The row and column calculations split the view into six columns and however many rows are required based on the number of journey points selected in the map:
Help Overlay Screen
The help screen is an image that has a show/hide button associated with it. I describe this technique in more detail here. Note, it used to be the case that you had to put the image inside of a container to be able to have a show/hide button, however, this is no longer the case and the show/hide button can be associated directly with the image object.
Continent Filter / Zoom
To allow the user to more easily make location selections, they can zoom into a region using the panel on the left. Selecting a continent sends that value to a parameter using a parameter action and a filter is applied to the map using that value. Note that journey legs outside of the filtered region will no be visible but will reappear when the user returns the full world view:
Change the Default Highlighting Effect
To ensure that when you select a continent the other continents are not greyed out (which is standard functionality), a dummy highlight action is used.
This was a technique I learned from one of Bethany Lyons product demonstrations for the release of Set Actions (version 2018.3). The same technique is used in a few other parts of the dashboard.
A different technique is used to deselect buttons after clicking on them. There are actually two buttons in the view with a True or False value in a dimension next to the buttons. That value is then flipped to the opposite value when the button is clicked using a parameter action, which essentially redraws the button thereby removing the highlight. The True/False header is hidden in the dashboard (but shown in the screenshot below):
An alternative is to use a dummy True/False filter action; a technique that Luke Stanke describes in this blog post.
You can interact with and download the workbook from my Tableau Public page here. Note, the response times are quicker on the Tableau Public server than they are in Tableau Desktop.
It’s important to stress that the figures shown in the dashboard are very approximate. They are based off of the values found in this BBC article and calculated using the distance calculation within Tableau, however, that distance is assuming a straight line between the two points so will not be the actual distance travelled by road or rail etc.
I hope this post was useful in exploring some techniques that you might be able to repurpose and apply in a different context in your work and maybe even helped you plan your next trip!
As always, thanks for reading and if you have any feedback, feel free to comment below or message me on Twitter.
Latest YouTube video
This video tutorial steps through how to create a dot plot in Tableau.
Leave a Reply