Category guide / Composition

Choosing a Composition Chart

Use Pie or Donut for a small partition of one total, stacked bars for parts across categories, and 100% stacked bars for shares. Choose Treemap or Sunburst when the parts belong to a hierarchy.

Make the First Choice

Match the question and data to the chart
Question or detailChartWhat to check
What share belongs to each part?Pie ChartNonnegative values that partition one defined whole.
Can the total help explain the shares?Donut ChartThe same part-to-whole data, with room for a total in the center.
Which of several similar shares is larger?Bar ChartA common baseline that makes small differences easier to compare.
How do totals and contributions differ across categories?Stacked Bar ChartNonnegative contributions measured in the same units, with one total per category.
How does composition differ when group sizes vary?100% Stacked Bar ChartShares calculated from each category total, with raw values available for context.
Which nested groups occupy most of the whole?TreemapOne hierarchy with proportional leaf areas and calculated parent totals.
How do branches divide through successive levels?Sunburst ChartChild angular spans within each parent branch; ring depth shows hierarchy.

WORKED EXAMPLE / ILLUSTRATIVE DATA

Show How 200 Visits Arrived

Imagine 200 fictional visits classified by one acquisition source each. The classification is mutually exclusive: every visit belongs to exactly one row.

Illustrative values for this example
SourceVisitsShare
Search10050%
Direct6030%
Referral4020%

The whole is 200 visits, and the shares add to 100%. A donut could put “200 visits” in its center. If you remove referral traffic, the remaining slices describe a different denominator unless you retain an explicit “Other” segment.

Use a Hierarchy When Membership Matters

Treemap divides a rectangle into nested areas. Sunburst follows branches from the root in the center through successive rings. Both ChartTypes editors use stable IDs and parent references, allow repeated display labels, and calculate parents from leaf values. Adding parents to their descendants would count the same amount twice.

Compare leaf areas in Treemap. In Sunburst, follow angular spans within each ring; outer sectors have more area because their radius is larger. Neither layout is as precise as bars for small differences, and tiny nodes may need the data table to remain readable.

Retain the Denominator When Normalizing

Ordinary stacked bars preserve both the total and each contribution. A 100% stack removes the difference in total size so every positive group fills the same height. Keep raw totals available, since the same share can represent very different amounts.

A zero-total group has no defined shares. The ChartTypes percentage stack retains that row and labels its zero total instead of inventing percentages. A missing value is an invalid draft, not an automatic zero.

Define the Whole Before Calculating Shares

State the population, time period, and exclusions. “Share of visits this week” is different from “share of customers this year.” Check whether your categories overlap before normalizing their values.

A survey that lets people choose several answers can produce percentages above 100% in total. Separate bars can show those response rates; slices of one circle would imply a partition that the data does not contain. Negative values also need another display.

Keep Small Segments Readable

Use clear labels with category names and percentages. Keep rounding consistent and explain a total of 99% or 101% if it arises from rounding. Combine small categories only when the combined group remains useful to the reader.

Several pies require readers to compare angles across circles. A grouped bar chart usually makes a two-period comparison easier. A 100% stacked chart can compare proportions, but also include totals when group sizes differ substantially.

Before You Publish

  • For nested data, calculate parent totals from leaves without double counting.
  • Verify that each observation belongs to one part.
  • Name the denominator and period.
  • Retain an accessible table of counts and shares.

Explore Working Examples

Open a chart to inspect its sample data and compare code in six libraries.

Keep Exploring

Choosing a Comparison ChartChoosing a Trend Chart