Stacking Marks

Stacking marks is relevant when your data view includes numeric axes. That is, at least one measure has been placed on the Rows or Columns shelves. When marks are stacked, they are drawn cumulatively along an axis. When marks are not stacked, they are drawn independently along an axis. That is, they are overlapping.
Stacking marks is particularly useful for bar charts which is why Tableau automatically stacks bars. You might find that stacking marks is useful for other marks such as lines as well. You can control whether marks are stacked or overlapping in any given view by selecting the Analysis > Stack Marks menu item. You can either allow Tableau to automatically select whether the marks are stacked or you can specify On or Off. The default setting is Automatic. When you are in automatic mode, the Stack Marks menu shows whether stacked marks is on or off.

Selecting On or Off on the Stack Marks menu,switches into manual mode. Your selection remains throughout any changes you make to the view.
The following examples illustrate stacking marks.
  1. Example – Stacking Bars
  2. Example – Stacking Lines

Example – Stacking Bars

Consider the stacked bars view shown below. It was created by placing a dimension on the Columns shelf, placing a measure on the Rows shelf, and color-encoding the data by a dimension (that is, dropping a dimension on the Color target on the Marks card).

Because the mark type is a bar, Tableau automatically stacks the marks. This means that the marks are drawn cumulatively and the height of each stacked segment within each bar represents the value for that segment. For example, the sum of the profit for products shipped by Express Air (orange bar segment) in the Consumer market is $121,252.
If you un-stack the marks, they all start from the horizontal axis. As shown below, you can still view the individual bar segments. Be aware, however, because un-stacked marks overlap, it is possible to create a view where bar segments are not visible.


Example – Stacking Lines

Consider the data view shown below. It was created by placing a date dimension on the Columns shelf, placing a measure on the Rows shelf, and color-encoding the data by a dimension (that is, dropping a dimension on the Color target on the Marks card). Because the mark type is Line, the marks are not automatically stacked. Instead, they are drawn independently from the horizontal axis.

Interpret any data point by reading the associated values from the horizontal and vertical axes. For example, in the year 2010, the Corporate (orange) sales totaled $486,960. That is, the space between that data point and the horizontal axis is equal to the sum of the sales for the Corporate market.
Now, stack the marks by selecting the Analysis > Stack Marks > On menu item. Tableau automatically switches to the Area mark type.

In this view, the lines are no longer independent of each other. Instead, they are drawn cumulatively. The stacking order is given by the order of the dimension members in the data source. This order is reflected in the color legend, from bottom to top.
Therefore, the stacked Small Business (red) area is the same as its un-stacked version because it’s at the bottom of the stacking list. The stacked Home Office (green) area is derived by adding its un-stacked values to the un-stacked Small Business values. The stacked Corporate (orange) area is derived by adding its un-stacked values to the stacked Home Office data. The stacked Consumer (blue) area is derived by adding its un-stacked values to the stacked Corporate data.
The vertical axis gives the new scale for the stacked marks. Interpret the filled area as the sum of the profit.
For example, notice that the label for the 2011 Corporate data still shows the profit as $486.960. The interpretation is that the space between the Corporate data and the Home Office data yields the sum of the profit for the Corporate market.

No comments:

Post a Comment