Calm motion: animations on this site only fade, with no movement
Waterfall chart
How a value goes up and down, step by step
Shows how a start value becomes an end value through a list of changes, for example the money of a month: income goes up, costs go down. For values that you compare side by side, use the bar chart.
Basic
| Step | Change | Total |
|---|---|---|
| Start | +$1200 | $1200 |
| Sponsors | +$2400 | $3600 |
| Members | +$860 | $4460 |
| Hosting | $-320 | $4140 |
| Editing | $-1500 | $2640 |
| Gear | $-540 | $2100 |
| End | – | $2100 |
stepsis a list of{ label, value, total }. Each step adds its value to the sum, so its bar goes from the sum before it to the sum after it.- A step with
totalhas no value. Its bar goes from zero to the sum so far, for example the end of the month. A first step with a value is the start. - A step that goes up is green, a step that goes down is red, and a total has the first chart color. The hover and the table also show the sign, so the chart does not depend on color.
- A dashed line goes from the end of each bar to the start of the next one. A hover on a bar shows its change, or the total.
- The chart draws at the width of its container, and
heightsets the height (default 280). - The chart is hidden from screen readers, and a table of the steps (step, change, total) is read in its place.
labelnames the table, andformatsets the text of a value. Change the column names withlabelsor a label pack:step,change, andtotal. - The chart is drawn as plain SVG. There is no chart library to install.
Usage
ts
import { BlessWaterfallChart, type BlessWaterfallStep } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
steps* | BlessWaterfallStep[] | — | |
height | number | 280 | |
format | ((v: number) => string) | — | text for one value, for example `(v) => "$" + v` |
label | string | "Chart" | names the chart and its table for screen readers |
labels | Partial<{ step: string; change: string; total: string; }> | — |