Comparison · Intermediate
Waterfall chart
Breaks the change from a start value to an end value into its drivers.
- Use when
- Explaining why last month's revenue became this month's
- Avoid when
- More than 12 drivers
Try it
07
Waterfall chart
Revenue from Sep to Oct (10k KRW)
- Increase
- Decrease
Hover over the chart, or Tab in and use the arrow keys to move between items. The numbers are sample data.
Variants
Named looks for this chart. Each one is the example above with a few options or fields changed. The CLI (ztd-charts example waterfall --variant <id>) and the MCP server know the same names.
Without connectors
Revenue from Sep to Oct (10k KRW)
- Increase
- Decrease
Code
WaterfallChart.tsx
import { ChartCard, WaterfallChart } from "ztd-charts";
const data = [
{"item":"Sep","amount":3200,"kind":"total"},
{"item":"New","amount":1100},
{"item":"Repeat","amount":450},
{"item":"Discounts","amount":-380},
{"item":"Refunds","amount":-270},
{"item":"Oct","kind":"total"},
];
export function Example() {
return (
<ChartCard number="07" title="Waterfall chart" subtitle="Revenue from Sep to Oct (10k KRW)" takeaway="What drove the change" level="intermediate" legend={[{"label":"Increase","color":"neutral"},{"label":"Decrease","color":"neutralStrong"}]} replay>
<WaterfallChart
data={data}
label="item"
value="amount"
type="kind"
/>
</ChartCard>
);
}
Props
<WaterfallChart> takes these props. Rows marked Common work the same on every chart.
28 props
| Prop |
|---|
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[] |
labelRequiredItem name fieldstring | (d, i) => string |
valueRequiredChange (total rows may omit it)string | (d, i) => number |
type"total" makes a total barstring | (d, i) => string |
startTotalTreat the first row as the starting totalbooleanDefault true |
endTotalRunning total bar at the end. A string sets its nameany |
connectorsLines between barsbooleanDefault true |
heightCommonHeight in px. Without it, each chart picks a default that fits its widthnumber |
widthCommonFixed width in px. Without it, the chart fits its parentnumber |
highlightCommonItem to highlight. An index, a name, an array, or "max" | "min" | "first" | "last" | "none"number | string | (number|string)[] | "max" … |
formatCommonValue format. "number" | "integer" | "percent" (values are already percents: 42 → "42%") | "ratio" (0.42 → "42%") | "compact" | "currency" (KRW for Korean locales, otherwise USD; for another currency pass Intl options with currency) | "decimal" or Intl.NumberFormat options"number" | "percent" | "compact" | … |
unitCommonUnit appended to values. For example "%" or "ms"string |
localeCommonLocale for numbers, dates and the text a chart writes itself (tooltips, screen reader sentences). "ko" or "ko-*" switches to Korean. Falls back to the ThemeProvider localestringDefault "en-US" |
animateCommonEntry and update animationbooleanDefault true |
durationCommonAnimation length (ms)number |
easingCommonMotion curve"spring" | "easeOut" | "easeInOut" | "linear"Default "spring" |
staggerCommonDelay between items as they enter (ms)number |
reducedMotionCommon"auto" follows the OS setting. true always turns motion offanyDefault "auto" |
animateOnViewCommonPlay when the chart scrolls into viewbooleanDefault true |
showLabelsCommonLabels drawn on the chart (values and names)booleanDefault true |
tooltipCommonShow tooltips. { template: "{label} · {value} · owner {owner}" } writes them: {label}, {value}, {series} or any other column of the row. \n starts a new line, and a line with an empty value is left outtooltipDefault true |
syncIdCommonCharts with the same syncId show the hovered x together (line, area, bar, candlestick). <ChartGrid sync> sets one for every chart inside itstring |
ariaLabelCommonName for screen readersstring |
descriptionCommonDescription for screen readers. Built from the data when omittedstring |
onHoverCommonRuns when hover or keyboard focus moves to another item(e: ChartEvent | null) => void |
onClickCommonRuns on click, Enter or Space(e: ChartEvent) => void |
replayKeyCommonReplays the entry animation when it changesstring | number |
themeCommonChanges theme tokens for this chart onlyPartial<ChartTheme> |
Also in Comparison
- Pareto chartBars sorted largest first with a cumulative share line
- Radar chartCompares several metrics at once
- Bar chartGrouped, stacked, 100% and horizontal bars, with optional lines on the same axis
- Slope chartChange in size and rank between two points in time
- Dumbbell chartThe gap between two values per item (before and after, target and actual)
- Lollipop chartA line and a dot instead of a bar. Stays light with many items