Chart Stacking

Stack series when each category total is meaningful and segments show contribution.

Decision guide: Same stack_group id → stacked. Negative values → StackOffset::Diverging (bar default). Share of whole → StackOffset::Expand. Unsure about layer order → try StackOrder::Ascending.

Assign the same stack_group on multiple series to stack segments per category. Bar stacks default to StackOffset::Diverging for signed data; lines and areas default to StackOffset::None.

  • Assign the same stack_group string on series that should stack per category.
  • Set stack_offset on any member — Diverging for signed bars, Expand for 100% stacks.
  • Set stack_order when layer sequence at the baseline matters.
  • Use ChartStacking preview variants to compare bar vs area stacking side by side.
Stacked bar chart (diverging default)

Three stacked segments per month including signed adjustments. Bar stacks default to diverging offset so negative segments mirror below the baseline.

20406080Amount (USD)JanFebMarAprMayJunJulMonth
Stacked area chart

Multiple filled series sharing a stack group. Compare with area-chart-percent-preview when you need stack_offset: Expand normalization.

5k10k15kAmount (USD)JanFebMarAprMayJunJulQuarter