In mid-April, I published the below visualisation that used data from Google’s Community Mobility Reports to show, at a country level, how people of a selected country were adapting their behaviour in response to the Covid-19 pandemic:
Since then, I’ve seen other visualisations of this data at lower levels of granularity. First, this one from Frans Geurts:
In which, Frans mentioned his work was inspired by this earlier visualisation by Sjoerd Mouissie:
These examples inspired me to take another look at the Google data at this lower level of granularity using a similar grid layout, focussing on the UK.
Summary and Detail Views
The Google data for the UK contains 151 locations (which are a mix of cities, counties, county boroughs and council areas), so I had to decide whether to show all of these – some of which had a fair amount of missing data – or selected locations only.
In the end, I opted for two views. A summary view, which showed:
- The four countries that make up the UK.
- The largest locations by population within each country. This included two cities each for Scotland, Northern Ireland and Wales and, due to it making up a much larger percent of the overall UK population, nine locations for England.
- For each country, an “Other Locations” line, which showed the average of values for all other locations.
Then a detail view, which included:
- All locations for the whole of the UK, except for those that had more than 30 days of missing data, which were filtered out.
- A UK Average row, which was highlighted in red, so any location could be compared to the average.
- All locations sorted by the change in mobility/activity, from greatest increase to greatest decrease.
- The functionality to swap the location category by using parameter actions (more on that below).
These two views enabled the viewer to see at a glance how the main areas of the UK were adapting to lockdown over time in all location types (Residential, Parks, Workplaces etc.), and then be able to see more detail for a chosen location category.
An example of part of the Summary view, for the Parks location category, is shown below:
In the above image you can see that areas in England have seen an increase in mobility (essentially more people visiting these types of spaces) in the most recent week or two, likely due to a greater easing of the lockdown guidance in England compared to other parts of the UK.
To switch between the Summary and Detail dashboards I used a navigation button. Next to this I placed a text label of the current view and added a bar underneath to indicate the current selection:
The line and bar underneath the words are created from two ‘blanks’ with a grey background colour.
Changing the Location Category
This UI component needed to be dynamic, so for this I used a view with six icons, one for each category, and a parameter action such that clicking on a an icon updated the parameter:
To create the bar underneath the selected category, I used the same parameter to colour six bars in a separate view. The selected bar became grey and all others became white. Below is the view used (I’ve added borders here so the separate bars can be seen clearly):
The colour calculation used and colour assignment (grey and white) is below:
Auto-Deselecting the Icon
To ensure the non-selected icons are not greyed out and to also ensure the selected icon does not receive a black border, I used a filtering technique that I have been using extensively since learning about it, as have many others in the Tableau community. All credit to Yuri Fal who shared this with the community on twitter in Dec 2019:
See my earlier blog post where I first used this technique for more details.
The exact location of some of the places in the data were unfamiliar to me (I knew Gwynedd was in Wales, for example, but where exactly, I couldn’t say). Therefore I added a small map within a tooltip, which, as well as providing other details, such as the exact percentage change and date, it would also show the location of the place name hovered over. Below, is the tooltip for the aforementioned Gwynedd:
If the viewer hovers over the “Other Locations” row in the Summary dashboard, all locations are shown:
Custom Highlighting a Location
Given the number of locations, I wanted to provide a way for the viewer to easily find their location of interest. I first tried using the inbuilt highlighter in Tableau, which works well:
However, in this case I didn’t want to dim all the other parts of the visualisation, I just wanted to highlight the name:
To create this effect, I used the below calculation to ensure the UK Average is always highlighted along with the selected location from a parameter, which was added to the dashboard at the top of the list of countries:
Two calculations were then created: Highlight and No Highlight:
These were both placed on the Label shelf and the highlight calculation formatted as red and bold with a slightly larger font size. A location is either highlighted or not highlighted, so only one of these labels will show:
Explore the Visualisation
If you are interested to learn more about how the visualisation is constructed you can now “Explore” it using this new functionality in Tableau Public. Click on the image below to open the visualisation in Tableau Public, then click on the “Explore (Beta)” button on the top right, shown below:
This will take you into Web Edit mode where you can see the different Views (sheets) that make up both Dashboards as well as see any calculations and parameters. You can make changes if you wish and then, if you want to keep those changes, you can simply click the Save button to save the visualisation to your own Tableau Public profile.
Click the image below to start exploring!
Latest YouTube video
This video demonstrates combining Cloudinary’s dynamic image creation service with Tableau’s new Image Role feature.