How to Create an Area Stack Chart

What is an Area Stack Chart?

An area stack chart is a data visualization which depicts a quantitative variable (on the y-axis) over time (on the x-axis).

Example Area Stack Chart

The variable on the y-axis is broken down into multiple series, or groups, which are stacked on top of each other with the area in between them representing the value of the specific series.

The area stack chart is a variation of a line chart with multiple series, where the area under each line is filled in and stacked on top of one another.

When to use an Area Stack Chart

Area stack charts display the portion that each series contributes to the total. This is where area stack charts differ from multiple line charts.

With area stack charts, it is easy to distinguish the total sum of the series and relatively how much of that total is made up of each series.

For example, a retail company can use an area stack chart to track its sales over time for each department. Each stack represents a different department, and the height of the stack at each time step represents the total sales of all departments. On one visualization, you are able to note the total sales, the sales of each department, and a visual of how much each department is contributing to the total.

Another powerful use of the area stack chart is visualizing Google Analytics data to track website visitors broken down into certain categories.

How to Create an Area Stack Chart

In Chartio, creating an area stack chart is simple using Interactive Mode and the Data Pipeline. In this tutorial, we’ll be working with the Chartio Demo Source data provided with your Chartio subscription.

Let’s go through the steps to produce an area stack chart of marketing spending broken down into different mediums.

Step 1 – From your Chartio page, click the Explore tab in the upper left-hand corner to begin building the table chart. Then, select the Area Chart icon located in the chart preview section on the right-hand side.

Chartio Area Stack Chart

Now we are in the Data Explorer and ready to build our chart. Our data source is located on the left side of the page. If you do not see Chartio Demo Source where the red circle is above, click on the down arrow and select the correct data source.

At this point, it is not necessary to select the type of chart. You can change the chart type at any point in time, provided the data you are working with matches how Chartio builds the chart.

When picking a type of chart before you select any data, the chart preview will show how to format your data for that chart.

Step 2Click Marketing under the Chartio Demo Source to expand the Marketing table. Drag the Cost measure to the Measures section under Interactive Mode. Drag the Created Date and Description dimensions to the Dimensions section.

Area Stack Query

Step 3 – Let’s look at the total cost of each Marketing type by month. Under the Dimensions tab, select the arrow next to Created Date. Under Time Bucket select Month of Marketing.CreatedDate. This will group any aggregations by month.

Area Stack Query

Step 4 – Let’s include a Filter to our visualization. In this case, we’ll look only look at data from the last 6 months. To achieve this, drag the Created Date dimension to the Filters section. When selecting Created Date in the Filters section, a drop down will appear. Select last N months and input 6.

Area Stack Filter in Chartio

We now have all the correct data that we need to create the area stack chart. Select Run Query.

At this point, you should have a warning message above the chart preview.

Chartio Warning

While we have the correct data, it needs to be in the right format to be used as an area chart. For this next step, we will use the Data Pipeline to pivot the data.

Step 5 – Below the Interactive Mode section and the Output Preview is the Data Pipeline. Select +Add Transformation. Under the Transform column, select Pivot Data. Then, select Apply & Close.

Area Stack Pivot Transform

Finally, we have created an area stack chart displaying marketing costs by month for different marketing categories.

Area Stack Chart in Chartio

There are a number of settings which can be changed under the Settings icon above the chart preview. For this example, let’s enter a chart title and sort the layers by area.

Chartio Settings Page

Best Practices for Creating an Area Stack Chart

As with most visualizations, it is best to keep the area stack chart simple and use as few series as possible. More than five series on an area stack chart can make it difficult to gain any insight from the chart.

If you are more concerned with visualizing the percentage of each category as opposed to the actual value, it may be better to use a Parfait Chart. Let’s compare the chart we created in the example with a Parfait Chart:

Parfait Chart

In the Parfait Chart, the y-axis is by percentage and not actual value. This chart is useful when you are only concerned with the relative percentage of each series compared to each other. For this example, it is clear that Adwords usually is the largest share of marketing spending.

Other ways to make the most of the area stack chart include:

  • Sorting the layers by area for easier interpretation.
  • Limiting the number of series (around 5 maximum).
  • Using the Parfait Chart to observe relative percentages.
  • Using monochromatic color schemes so the layers do not appear to be random.

Chartio also includes a tooltip which allows the user to hover over data points or time steps to view the exact values of each series.

With Chartio, it only takes minutes to connect your datasets and create powerful visualizations like these.

About Patrick Gibson