Square Option - Explained across Different Charts
You can create different types of charts in Tableau using the Square option on the Marks card. In this post, I will walk you through creating Tree maps, Calendar Heatmap, and Marginal Bar Charts.
A treemap can be used to display part-to-whole or hierarchical relationships using rectangles or squares as the area of measure. Let's see how to show the part-to-whole relationship between categories for sales.
Drag Sales to Size and Category to Color.
To distinguish between the different squares, add labels. The order you drag the fields onto the Marks card is the order in which the labels would appear. Here, let's put Category and then Sales onto Label.
The Treemap would look like this:
Note: You can manually edit the label by clicking the Label property. This will bring up a box where you can edit different elements of the label. Select the three dots next to the Text option to edit what appears on the label.
Treemaps have good visual appeal. But it could take longer for the user to interpret a treemap over a bar chart because human eye interprets length better than the size of an area. A treemap orders the segments based on highest to lowest, with the largest section being in the top-right area.
To show how the subcategories fit into these categories, drag the sub-category onto the Label. The treemap with sub-category looks like this:
You can also add Sub-category to Color. This would color the areas by category with different shades per sub-category. The treemap will now look like this:
One main advantage of treemaps is that you can use multiple measures.
Calendar heatmap is similar to text highlight table, with dates to give a calendar feel to the heatmap.
Let's see how to display a single month of a calendar to show the number of orders shipped by day.
First, you have to filter to a single month. To do this, drag Ship Date to Filters, select Month/Year, and choose the required month.
2. Now, let's build the calendar. Right-click and drag Ship Date to Rows.
3. Upon right-clicking and dragging, you should get the Drop Field date pop-up box. Select WEEK (Ship Date).
4. Next, we need our weekdays, so right-click and drag Ship Date to Columns. In the pop-up box select WEEKDAY (Ship Date). This is how your calendar map should look like, week numbers going down and week-days going across:
5. Add the actual day number to the view. Right-click and drag another Ship Date to Text on the Marks card and select Day (Ship Date).
6. To move the day number to the top right of the area, go into Label and change the alignment to horizontally right and vertically top.
7. Now, let's add the orders. Right-click and drag Order ID to Color and select CNTD.
8. Change the mark type to Square. The final calendar map should look like this:
By creating the Calendar map in Tableau, you can see the number of orders that are due to be shipped on a certain date. It can be used to plan resources as required.
A Calendar heatmap shows hot and cold spots in a monthly view.
Marginal Bar Charts
A Marginal bar chart is a mix of heatmaps and bar charts together on a dashboard. Let's see how to create a marginal bar chart to see which weekday and week was most popular for shipping orders.
Duplicate or re-create the above calendar heatmap.
Now, create a vertical bar chart that shows the number of orders per weekday, regardless of week. On a new sheet, right-click and drag Ship Date to Columns and select WEEKDAY. Right-click and drag Order ID to Rows and select CNTD.
Also add CNTD (Order ID) to Color.
4. For the second bar chart, create a horizontal bar chart that looks at weeks irrespective of weekdays.
5. On this newly duplicated sheet, use the Switch Axis button to switch to a horizontal bar chart instead of a vertical one.
6. Change the weekday field on Rows to WEEK: Right-click this field and select Week Number. The sheet should now look like this:
7. Apply the Month/Year filter from Calendar HeatMap to the WeekDay and Week Histograms. To do this, go to the calendar heatmap sheet, right-click the filter, and select Apply to Worksheets - > Selected Worksheets.
8. From the pop-up box, select the specific worksheets you want to add the filter to:
The histogram sheets will now this:
9. Now, let's bring them all together on a dashboard. Create a new dashboard and start drag the Calendar HeatMap.
10. Add the weekday bar chart above the calendar heatmap:
11. Add the week number horizontal bar chart to the right-hand side of the calendar heatmap.
12. Now, we have to clean up the dashboard and make sure everything aligns. The dashboard will look like this:
13. Hide the tiles of each worksheet by right-clicking the title of the worksheet.
14. Unshow the axis and headers by right-clicking either the axis or header.
15. Repeat steps 13 and 14 for the Week Histogram sheet.
16. Hide Column and Row field titles. The sheet will now look like this:
17. As the Calendar Heatmap is the central chart, let's make it bigger.
18. Add labels to the bar charts by selecting the sheet and clicking the T icon on the toolbar. The final chart will look like this:
The Square Mark type is useful for building Treemaps and Heatmaps in Tableau. Heatmaps are especially useful when trying to convert users from tables in Excel to something more visually appealing.