In terms of mapping, by design, Tableau allows to display data only as a filled map or single points placed in the middle of analyzed area. However, using few tricks, software limitations can be slightly shifted in this case as well.
I will be using Sample Store Datasource in this tutorial and will extend map usage to display:
- Pie Charts
- Bar Charts
Pie Charts on the Map
Showing pie chart on map brings additional functionality to the Viz – it allows to quickly evaluate multiple values in region at the same time
To display pie chart on the map you need to pull your regional data onto the blank sheet. Tableau should automatically generate Longitude and Latitude values for your coordinates and place them on Columns and Rows shelf. Note that your regional field will be also placed in the Details section of the Mark shelf – don’t remove it. Your current map view should be “Symbol Map”. If you are seeing filled map instead, simply go to “Show Me” menu and select “Symbol Map”
Now you need to add fields holding pie angle and color information. First of all, navigate to marks shelf and switch Marks type to Pie Chart. Then add field keeping values to Angle Mark and Coloring field to Color Mark. You should end up with something similar to this:
You can even show donut chart on the map
Displaying donuts requires use of secondary axis to plot “donut hole”. Simply place Longitude pill once again on the Columns shelf, right click on it and select “Dual Axis”. Note that there’s new tab on the Marks Shelf which is very similar to the previous one. We need to customize it to make it even better!
Change mark type to circle
Type 1 in directly in the shelf and change it’s attribute to min and pull it to color
Pull Quantity field to label
Feel free to play around with Size marks of both tabs (first and second Longitude) to fine tune donut and hole sizes
Bar Chart on Map
Showing Pie Chart is kinda simple as it uses ‘native’ Tableau functionality. Displaying Bar Charts requires pushing beyond of standard approach to this software.
Let’s try to show Segment split by Quantity for each of the States
You may already see that something is wrong here – it does not look as good as other, standard Tableau vizualisations. That’s true. This is mostly because it’s very far from standard. You have to have in mind that approach described below should be taken only if you are forced to push the limits. In most of the cases, native Tableau functionality will work better.
Let’s start with plotting standard map. Pull Region field onto the blank sheet. As in the previous example, Tableau should automatically plot Longitude and Latitude on Rows and Columns shelf and Regional field in the Details section of Marks Shelf.
Now you need to create a set of calculated fields which will hold part of information which is displayed. This is the limitation of this technique: everything that is displayed need to have it’s own calculated field. There is no way to serialize it.
Create Calculated Fields:
LEFT("██████████", round( sum(if [Segment]="Consumer" then [Quantity] end)/ sum([Quantity])*10, 0) )
str(zn(round(( sum(if [Segment]="Consumer" then [Quantity] end)/ sum([Quantity]))*100,0))) + "%"
As you can see, general concept assumes displaying part of 10 ASCII symbols as bar.
Repeat those fields for each of Consumer, Corporate and Home Office Series. You should end up with 6 fields in total.
Having that setup, pull all those 6 fields to Text Mark in the Marks Shelf
Having them all in one place, they can be used as a single Label on the map. Click Text Mark and edit entries in the Label editor:
<AGG(Consumer Share)> <AGG(Consumer Share Value)>
<AGG(Corporate Share)> <AGG(Corporate Share Value)>
<AGG(Home Office Share)> <AGG(Home Office Share Value)>
Note that each of those elements can be formatted separately in terms of color, font size and alignment. Actually is the only way to play with aligning this label on the map. If labels overlap, you can alter size of the bar or add/remove spaces.
You can play with the viz below or download it for further investigation.