Skip to content

Stacked column chart ​

Stacked vertical column chart for composition over discrete columns; supports percent stacking.

column-stacked is the vertical sibling of bar-stacked — each column breaks down into segments. It's the right choice when the x-axis represents a small number of ordered steps (quarters, fiscal years, study cohorts). Set stackMode = "percent" for a 100 % composition view. See Properties for every key it accepts.

When to use ​

  • Composition over a small number of discrete columns (5–10 quarters, years, or stages)
  • When both the total and the breakdown matter for each column
  • 100 % stacked view (stackMode = "percent") when readers should focus on relative share

When NOT to use ​

  • More than ~10 time points — switch to area-stacked
  • Data with negative values — stacking breaks down
  • When precise segment-to-segment comparison is needed across columns

Example ​

bpc
chart column-stacked {
  theme = "blueprint-bold"
  colorPalette = "BlueprintBold"
  title = "Software revenue grew steadily while hardware spiked in Q4"
  description = "Quarterly revenue in millions, 2024"
  source = "Annual report"

  data {
    series = "Hardware","Software","Services"
    "Q1" = 120,85,45
    "Q2" = 135,92,48
    "Q3" = 128,98,52
    "Q4" = 155,105,58
  }
}

Properties ​

Every property column-stacked accepts, beside the frame and layout keys every chart shares. Anything absent from this table is rejected by validateChart and ignored by the renderer.

PropertyTypeDefault
colorscolors(unset)
colorPaletteselect, see PalettesBlueprint
autoContrastbooleanfalse
allowDarkModebooleantrue
barGaptext60
stackModeselect: normal, percentnormal
sortModeselect: none, total, within-groups, seriesnone
sortSeriesselect""
sortReversebooleanfalse
legendbooleantrue
legendAnchorselect: start, middle, endstart
legendPositionselect: top, bottom, left, righttop
directLabellingselect: "", auto, outside, inside""
directLabelAnchorselect: start, middle, endmiddle
showVerticalAxisbooleanfalse
verticalAxisDirectionselect: left, rightleft
showVerticalTicksbooleanfalse
verticalLabelPositionselect: auto, inside, outside, offoff
verticalGridStyleselect: solid, dashed, dotted, nonenone
verticalNumberFormatnumberFormat(unset)
verticalScaleTypeselect: linear, loglinear
verticalRangeMintext(unset)
verticalRangeMaxtext(unset)
verticalTickValuestext(unset)
showHorizontalAxisbooleantrue
showHorizontalTicksbooleanfalse
horizontalLabelPositionselect: auto, inside, outside, offauto
horizontalLabelRotationselect: auto, horizontal, verticalhorizontal
horizontalGridStyleselect: solid, dashed, dotted, nonenone
horizontalNumberFormatnumberFormat(unset)
valueLabelsbooleantrue
valueLabelPositionselect: auto, outside, insideauto
tooltipsbooleanfalse
crosshairbooleanfalse
crosshairDirectionselect: both, vertical, horizontalboth
crosshairStyleselect: solid, dashed, dotteddashed
crosshairColortext#999
showTotalbooleanfalse

Overlays ​

Overlays add a value mark (one extra column) or a range band (two extra columns) across each whole stack. Their values sit on the value axis, and overlay columns never add segments. A percent stack (stackMode = "percent") draws no overlay and validation warns.

Cues compare against the stack total, the sum of the row's visible values. muteIfCrosses on a range overlay fades every segment of a stack whose range includes the number. aboveColor and belowColor on a value overlay recolor every segment of the stack with one color, by whether the total reaches the mark. The series keep their colors in the key.

See overlay for the keys and an example.

Common pitfalls ​

  • Stacking too many series — the top layers float and lose their baseline
  • Switching to stackMode = "percent" without telling the reader hides the change in absolute total
  • Inconsistent segment ordering between columns destroys the visual flow
  • showTotal labels the sum of the positive segments only; negative segments are left out and a column with no positive value gets no total. It is off in percent mode, where every total would read 100 %
  • bar-stacked — horizontal equivalent for long category labels
  • area-stacked — same idea with many time points
  • bar-multi — when you want side-by-side comparison instead of stacking

See also ​

Released under the MIT License. Built static-first — your data never leaves the page.