Author avatar

Recnac

Tableau Playbook - Area Chart in Practice Part 2

Recnac

  • Jul 22, 2019
  • 10 Min read
  • 26 Views
  • Jul 22, 2019
  • 10 Min read
  • 26 Views
Data
Tableau

Introduction

This is the third part of a three-part series on Tableau Playbook - Area Chart. In the first part, we delved into theoretical knowledge. In the second part, we practice with two advanced area charts. Check it out in case you missed it.

In this guide (Part 3), by analyzing a real-life dataset, Rossmann Store Sales, we will practice another two of the typical area charts with advanced features step by step. Meanwhile, we will draw some conclusions from Tableau visualization.

Continuous, Unstacked, and Opaque

Let's go ahead and create a continuous, unstacked, opaque area chart to solve the previous drop-line problem.

  1. This time, we’ll build an area chart manually:
  1. Drag "Date" into Columns Shelf.
  2. Drag "Sales" into Rows Shelf.
  3. Drag "Assortment" into Marks - Color.
  4. Choose Area as the Marks type.

continuous unstacked area chart 1

  1. Change the area chart from discrete to continuous: right-click "YEAR(Date)" on Columns Shelf and choose Month from continuous Date Values.
  1. Aggregated by median which we have discussed before. Right-click "SUM(Sales)" on Rows Shelf and choose Measure -> Median.
  1. Tableau stacks colored areas by default. We need to switch to the unstacked version: navigate to Analysis -> Stack Marks -> choose Off.

continuous unstacked area chart 2

  1. If we unstack the areas, we should change the colors to opaque to avoid color overlap. Click Marks - Color to expand the option panel:

continuous unstacked area chart 3

  1. Slide the Opacity to 100%.
  2. For the non-transparent area, we'd better add a white border effect which provides a clean-looking separation: expand Border in Effects and choose white color.
  1. Make more optimizations:
  1. Edit the Title to "Sales Trends Compared by Assortment".
  2. Right-click on the x-axis and click Format... Expand Dates in Scale options from the Axis tab and choose Custom. Then customize the format as mmm yyyy.
  3. Remove the date axis title "Month of Date" in Edit Axis...

continuous unstacked area chart 4

  1. Here is an optimization we should NOT make to an area chart. For line charts, when we focus on the trend or relative comparison, truncating the axis may clarify the differences in charts. However, area charts emphasize the absolute volume of an area filled. If we truncate the axis for clarification, or to make it more visually appealing, it will lead to a misleading graph.
  1. Actually, we missed an important step for unstacked, opaque area charts because we got lucky in this example. That is, reordering the areas to avoid occlusion. In general cases, we should adjust the orders in the color Legend to something like "funnel-type". We’ll build another chart to compare the median sales and total sales. In the following chart, we need to reorder the areas.
  1. Duplicate the current area chart.
  2. Convert "MEDIAN(Sales)" back to SUM.
  3. In order to put "extra" in the front of areas, drag "extra" to the top.

continuous unstacked area chart 5

Analysis:

Through comparative analysis for these two charts, we can see that although "extra" assortment contributes very little to the total sales (according to the second chart), the actual sales of each extra store are the highest (according to the first chart). This is because the store number of "extra" is the smallest.

Discrete and 100% Stacked

In order to use space more efficiently and make a better relative comparison, we can build a 100% stacked bar chart:

  1. We’ll build this area chart manually:
  1. Drag "Date" into Columns Shelf.
  2. Drag "Number of Records" into Rows Shelf.
  3. Choose Area as the Marks type.
  4. Drag "SchoolHoliday" into Marks - Color.

discrete 100% stacked area chart 1

  1. Change the date level from YEAR to MONTH: right-click "YEAR(Date)" on Columns Shelf and choose Month from discrete Date Parts.
  1. Convert to the relative comparison. The step is similar to 100% stacked bar chart:

discrete 100% stacked area chart 2

  1. Right click "SUM(Number of Records)" in Rows Shelf -> hover on Quick Table Calculation -> choose Percent of Total. Now you can see "% of Total SUM(Number of Records): 100.00%" the in the bottom status bar, which means 100% per chart, but we expect 100% per bar.
  2. Right click "SUM(Number of Records)" in Rows Shelf again -> hover on Compute Using -> choose Cell which means compute percentage using cell. Now it turns to 100% stacked area chart. Alternatively, you can operate in the Table Calculation panel.
  1. Since there is no overlap between areas, we can make the color non-transparent for a better view. Click Marks - Color to expand the option panel:

discrete 100% stacked area chart 3

  1. Slide the Opacity to 100%.
  2. expand Border in Effects and choose white color.
  1. In the end, let's polish it:
  1. Right-click on the horizontal header and click Format... Expand Dates in the Default option from Header tab and choose Abbreviation.
  2. Right-click on "SchoolHoliday" and choose Edit Aliases... Edit the members into "No" and "Yes".
  3. Edit the Title to "School Holiday Percentage Distribution over Month".
  4. Right-click on "Date" and choose Hide Field Labels for Columns.
  5. Switch to Entire View.

discrete 100% stacked area chart 4

Analysis:

Based on the original version, we find out that there are fewer records from August to December. But we don't care about the absolute number; we only care about the proportion of school holidays over month. So, a discrete, 100% stacked area chart is the best choice. It makes the full usage of space, and both holiday and non-holiday have a baseline. From this chart, we can see the proportion of school holidays in July and August was the highest and the lowest was in November.

Conclusion

In this guide, we have learned about area charts from practice. We drew another two typical area charts to demonstrate a variety of features, such as discrete vs. continuous, stacked vs. unstacked vs. 100% stacked, and opaque style.

You can download this example workbook Line Chart and Variations from Tableau Public.

In conclusion, I have drawn a mind map to help you organize and review the knowledge in this guide.

area chart practice 2 - mind map

I hope you enjoyed it. If you have any questions, you're welcome to contact me at [email protected]

More Information

If you want to dive deeper into this topic or learn more comprehensively, there are many professional Tableau Training Classes on Pluralsight, such as Tableau Desktop Playbook: Building Common Chart Types.

I made a complete list of common Tableau charts serial guides, in case you are interested:

0