Stacked Bar Chart Tool

Show part-to-whole relationships across categories with stacked segments.

Chart Data

Note: What Is a Stacked Bar Chart?

The Basics

A stacked bar chart segments each bar into colored sections stacked on top of one another, so a single bar shows both the total value of a category and how that total is split between parts. The full bar height communicates the overall magnitude, while each segment shows a component's contribution, often with a legend matching colors to parts.

This makes stacked bars a "part-to-whole" chart: they answer "how much in total, and how is it made up?" For example, a bar for each year can layer revenue from product lines A, B, and C, letting you see both total revenue and the mix behind it.

Common Use Cases
  • Revenue by product line across quarters or years, showing totals plus mix
  • Energy mix by source (coal, gas, renewables) over time
  • Population composition by age bracket or by demographic segment
  • Budget allocation showing how total spend is split between departments
  • Website traffic by channel, revealing both volume and channel share
Stacked vs Grouped vs 100% Stacked

Choose a stacked bar when the total and its composition are both important. Choose a grouped bar when you mainly want to compare series against each other rather than their sum. When you care about the proportion of each part rather than absolute size, use a 100% stacked bar, where every bar is normalized to the same total height and only shares are shown. Note that comparing middle segments across bars is difficult in stacked charts, since their baselines shift; if that comparison matters, a grouped bar or small multiples is a better fit.

How to Use It Well
  • Order segments consistently, for example always placing the largest share at the bottom
  • Use a limited palette of distinct, high-contrast colors for segments
  • Prefer a single stack per category for time series, and consider a 100% variant for shares
  • Label only key segment values to avoid clutter, and rely on tooltips for the rest
  • Keep the number of segments below about five for readability
  • Remember that only the bottom segment and the bar total have fixed baselines
Fun Facts
  • Stacked charts can be traced back to the "divided bar" diagrams of the 19th century
  • Florence Nightingale used a related divided diagram, the polar area chart, to argue for sanitary reform
  • 100% stacked bars remove the total and show only relative share, which is why they are also called "component bar charts"
  • Stacked bars are a form of stacked area chart cousin; area charts stack lines across time instead
  • In cartography, stacked bars are often used to show exports and imports by country
  • A consistent segment order across bars is one of the most cited readability rules in visualization guides
  • Interactive tools like ApexCharts let viewers hover a segment to see its exact value and percentage