Hierarchy Chart (Pic by Author)

Hierarchy Chart with Layers in Tableau

Priya Yogendra Rana
Geek Culture

--

Have you ever thought of a hierarchy (organizational) chart with some spatial functions and layers in Tableau?

Recently, one of the visuals for #vizforsocialgood required to project the benefits and the beneficiaries along with their values. And since the audience was general public, demonstrating the same in a hierarchy would easily communicate the message. Like other times, I started with the easy way out — solutions available on the Internet for organization chart. When none of the available options worked for me, the challenging ‘make your own solution’ was the only path left to travel.

The Backend prep work

The main preparation is done in the backend. Here, you will have to specify the hierarchy. Hierarchy always has a root point, first layer then second and so on and so forth. But to be able to define the hierarchy, we need two columns clearly defining a start point and an end point. In our example here, columns “From” and “To” are the points respectively. And for each point we need to specify the latitude and longitude coordinates i.e. From Lat, From Long, To Lat and To Long. Here, I would suggest keep the root at (0,0) and then plan the rest of the structure around it. However, do keep in mind to connect the second layer or whatever the last later is to itself as shown below to be able to show the final values. Now, we come to the Label column. This is very case specific. In the mentioned #vizforsocialgood case, there was a need for two columns — your requirement could be different. These will depend on what fields you want to show as labels, color and position. In the table below, one of the columns “Label” is the value of the last layer in the hierarchy. Refer Fig 2.

Fig 2 (Pic by Author)

Calculated Fields

We will need 3 calculated fields for the same. The coordinates mentioned above will not become a point until we ‘make’ it a point. So, to do the same, please refer Fig 3 and Fig 4.

Fig 3 (Pic by Author)
Fig 4 (Pic by Author)

Now, that we have the points we need to specify the path to clearly demarcate which point is connected to another. Makeline function allows you to do that. Refer Fig 5.

Fig 5 (Pic by Author)

The last calculated field is very case-specific. Reason being, I wanted the root point text to be in black. Refer Fig 6.

Fig 6 (Pic by Author)

Populate the Sheet

1. Drag “Path” calculated field to the Detail card of the Mark Shelf. You will notice 3 things happen simultaneously. The drop-down changes to map symbol and longitude and latitude appear in the Column and Row shelf on the top. You will also notice the structure of the hierarchy chart on the sheet with the map in the background. Here if you feel the need to rectify the structure or to increase or decrease the distance between the points then do that and refresh it. Refer Fig 7.

Fig 7 (Pic by Author)

2. Now place “only the root title”, “From label” field in the Label card and “From” field in the Tooltip card. For “only the root title”, uncheck option Include in the tooltip. In the Label box, set the color of field “only the root title” as black (html code — #000000) and “From Label” as white (html code — #ffffff). This last step is very case specific. Refer Fig 8.

Fig 8 (Pic by Author)

3. Now drag calculated field “To Point” to add another layer. Refer Fig 9.

Fig 9 (Pic by Author)

4. Drag the field “To” to the detail and “Label” field to the Label card of the ‘To Point’ Marks shelf. Don’t worry, if you will see an overlap in the labels in the lower most row.

5. Go to Map menu select Map layers and set the washout option as 100%.

6. In the same ‘To Point’ Marks shelf, change the drop-down from Automatic to Shape. You select the shape you want. You can choose a transparent shape or a filled shape, set the fill color as white and Halo as None. Increase the size as per your requirement. This gives it a more professional look. Refer Fig 10.

Fig 10 (Pic by Author)

7. In the visual, the requirement was that of a particular shape and with an increase in size, the final image looked like the one in the main picture above the title. Set the tooltip as you like.

8. After you have centrally aligned the chart and taken care of the overall size, go to Map menu, select Map Options and uncheck all the check boxes.

In nutshell, layers helped with selecting the size and color of the shape and labels, which otherwise would not have been possible.

With this, I’m finished with this blog post. There are other chart tutorials available online too, and I strongly recommend you to explore at least a few before deciding what meets your requirement. Au revoir !!

--

--

Priya Yogendra Rana
Geek Culture

Ex-Software Developer, MBA, Data Analyst Enthusiast. Bring together business focus and data skills