Makeover Monday week 2020-40 and Animated Hex Maps

The Makeover Monday for week 40 was looking at US counties with the highest Economic output, and the original visualisation is here:

I quite like the cleverness of it with the spiked maps, but it is a little busy and quite hard to see an awful lot in it.

I had seen quite a few Hex maps flying round on this subject, and I hadn’t really done one in earnest before – so this seemed a good time. I also wanted to do something a bit interactive with it and had the idea of being able to click on a state and have it animate by moving to a different point in the page and grow bigger.

In short I managed to do it, and the result is below:

However it was a little more fiddly (and therefore fun!) than I was expecting so I thought I would write my process down!

Step 1 – the Hex Map

The first step was to get the basic hexmap done, and I found a very helpful blog by Matt Chambers (https://www.sirvizalot.com/2015/11/hex-tile-maps-in-tableau.html.) which took me through this. This gets me with a sheet looking like this:

Step 2 – Updating the Position of the ‘Selected’ state and changing the size

In order to move the selected state to a different location, I needed to create a parameter for the state, and some calculations that change the row and column value based on if the state is selected (in the parameter) or not. As an example my updated column calculation looked like:

The -4.3 was done by trial and error, the row equivalent value was 1. I also fixed the map axes so columns went from -8 to 14, and rows from -1 to 9 (also worked out by trial and error). This gave me the space I needed.

In order to get the size of the selected hex to be larger, I created a calculation for the size shelf, again the 10 and 1 were trial and error until I got the size I wanted:

This in conjunction with the size slider enabled me to get a view like below:

Step 3 – the Animation

Initially getting the animation was quite simple, I just needed to set up a parameter action to update the state name and switch the animations on, this got me to here:

This is fine, but doesn’t look good as the selection stays active. So I tried doing the trick I normally use to deselect a mark, by passing ‘True’=’False’ into an action filter, unfortunately this seemed to cancel out the animation:

So I decided to get this working I needed to create some kind of transparent overlay to control the parameter selection where I didn’t have to worry about the selection staying active.

Step 4 – the Overlay

I created a separate overlay sheet that was a complete replica of the Hex map, but this time removed any text labels and changed the mark colour to be 100% transparent, so the user can’t see it. I then floated this over the top of the original hex map and changed the parameter action to run off this overlay. This worked as I had hoped and got the animation working again, but this time without the mark selection issue:

I was very pleased with this, but the one additional thing I wanted to do was also highlight the ‘Missing’ state was when the selected state had been moved (rather than leaving a gap).

Step 5 – the Background

In order to fill the gap that the moved state made, I decided to layer another identical hex map behind the two other hexmaps, but this time have a hexagon outline only show on the selected state – so it appears in the gap. FOr this I used the original Row and Column values (not my new adjusted ones) so it stayed in the normal configuration. This got the look I wanted:

Step 6 – Finishing Up

Finally I just added some titles, text and a top 5 County bar chart under the larger selected Hex to give some more information. Final dashboard:

And that was it! I quite enjoyed this as it is the first time I have really done this kind of layering before, and I found it gives some great interactivity. I’ll definitely be using this again!

Interactive version: https://tabsoft.co/37bJ57J

Ant.

2 thoughts on “Makeover Monday week 2020-40 and Animated Hex Maps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s