Hex map is quite popular for representing US geography in Tableau. Some asked how to create one for their own country or region. So here we will show the basic steps.

Hex map is a simplified way to represent a real map. It's an approximation. Some would say, even the "true map" is just an approximate representation of the reality, not the exact one.

Tableau Zen Master Matt Chambers proposed a Hex Map approach to US map. It looks great and seems better than tiled maps, because it tightly weaves all the State pieces together, thus looks a lot better. In a hex map, one state is neighbor to 6 states while in a tiled map, one state is neighboring 4 states.

But the hexagons are not close enough when using Tableau shapes. There left some gaps between states, especially when we resize the map.

Zen Master Rody Zakovich created a polygon based hex map, which is easy to resize while keeping the pieces always together. Zen Master Joshua Mulligan proposed a Spatial File based approach which also fixes the resize problem. But it is made with Alteryx which is a luxury not everyone can afford.

I made some improvement on Rody's polygon approach by eliminating the extra 51 rows for labeling.

Here I will show you the steps of creating a polygon-based hex map.

1. Understanding the data set
Load the hex map file (credit to Matt Chambers) to Tableau. It has got 51 rows of data. Each row contains one US state and its coordinates. For those who want to create your own Hex map, you need to create a data set like the one by Matt.

Horizontally between two neighboring data points, the distance is 2. Between two row of States, there is a horizontal shift of 1.

Vertically, the distance is 3.

2.Calculating the vertices of each hexagon
The above data set actually defines the center of each hexagon.

For a polygon-based hexagon, we need to define 6 vertices. Then a polygon is defined. For each of the 6 vertices, there will be one corresponding data row.

Given the horizontal and vertical distances, we derive the distances between each vertex and the center. Note that the horizontal and the vertical scales of a hexagon is different. So the calculation of the two coordinates are different too in scale.

//X is the horizontal coordinate of the center of a hexagon.
[X]
+COS(-[Pi]/2+[Table Index]*[Pi]/3)*2/SQRT(3)

//Y is the vertical coordinate of the center of a hexagon.
[Y]
+SIN(-[Pi]/2+[Table Index]*[Pi]/3)*2
3.Labeling
Labeling tiled map or hex map has not been a big issue but there lacked a systematic approach to it.

In our design, we used AVG() to the coordinates. When using dual axis for the labeling, we removed the vertex dimension and the AVG() of vertices will point to the center of the hexagon, thus very well positioned for labeling.

Voila, those are the main steps to creating a scalable and tightly woven hex map for any region on the earth. View the video for more details. Download the workbook here. You can use the map to blend with other data sets as you wish.
0

Add a comment

(Refresh the page if you want to view the gif image multiple times. Or go to Tableau Public and click the button at the top-right corner.)

Jake and I collaborated on a dashboard. He told me that he learnt a way to create an in-place help page in Tableau. He first saw it at a conference somewhere and couldn't recall who the speaker was. So I am blogging here about it but the credit goes to somebody else. If anyone knows who the original creator is, leave a comment below.

The key idea is to float a semi transparent worksheet on top of the dashboard, where a help text box is strategically placed on top of each chart. This way, we can explain how to view each chart and what data points are important, etc. This worksheet is collapsible by a show/hide button. 

Below I would like to show how this worksheet can be constructed.

1. Sheet with a single data mark.

  • Double click the empty space in Marks panel and add two single quotes. Make the null pill a text label. This creates a single null mark.
  • Set the view as "Entire View"

2. Create an show/hide button

  • Go to the target dashboard
  • Drag a floating vertical container to the dashboard, making it cover all the area of interest.
  • Drag the Single Null Mark sheet and drop it into the above container. Hide the sheet title.
  • Create an open/close button for the container and place the button at the top-right corner.

3. Add annotations

  • Format the sheet background opacity as 70% in the layout manager             
  • Select area annotations and place them anywhere of interest. 
  • Write help text and format it to highlight important messages.  
  • The text can serve as functional guide and/or insight guide.

Here is an example. Feel free to download the workbook and explore. Click the "i" button at the top-right corner to view the in-place help. 

0

Add a comment

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.