Charts
WaterfallChartNew in 0.8.0
Shows how a starting value is built up or eroded by a sequence of increases and decreases, ending in totals.
WaterfallChartPreview
Bar gap
Radius
Click a bar
Usage
tsx
import { WaterfallChart } from "@vesture/react";
<WaterfallChart
width={600}
height={320}
data={[
{ key: "o", label: "Opening", value: 500, type: "total" },
{ key: "n", label: "New", value: 220 },
{ key: "c", label: "Churn", value: -180 },
{ key: "e", label: "Closing", value: 0, type: "total" },
]}
/>Behavior
- Items default to type "delta" and float from the running total. type "total" anchors at zero; a total with value 0 shows the running total so far.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data | { key; label; value; type?: 'delta' | 'total' }[] | — | Required. |
| width / height | number | — | Required, in px. |
| positiveColor / negativeColor / totalColor | string | — | Override the success / danger / primary tokens. |
| showConnectors / showLabels | boolean | true | Dashed connectors and value labels. |
| barGap / barRadius | number | 0.3 / 2 | Bar spacing and rounding. |
| formatValue | (v: number) => string | — | Axis and label formatting. |
| onBarClick | (datum) => void | — | Makes bars clickable. |