Skip to content
peakcharts

WaterfallChart

Show how a starting balance becomes an ending one.

Revenue bridge
Revenue bridgeClick a mark to pin its value; click it again to release. Keyboard: Enter or Space to pin, Escape to release. Data table below.0106212318424OpeningSalesRefundsUpsellChurnClosingOpening: 240 (balance: 240)Sales: 160 (balance: 400)Refunds: -48 (balance: 352)Upsell: 72 (balance: 424)Churn: -35 (balance: 389)Closing: 389 (balance: 389)
Click a mark to pin its value
View data
Revenue bridge
LabelValueBalance
Opening240240
Sales160400
Refunds-48352
Upsell72424
Churn-35389
Closing389389
<WaterfallChart title="Revenue bridge" data={data} />

Usage

WaterfallChart.tsx
import { WaterfallChart } from 'peakcharts';
import 'peakcharts/styles.css';

const data = [
  { label: 'Opening', value: 240, total: true },
  { label: 'Sales', value: 160 },
  { label: 'Refunds', value: -48 },
  { label: 'Upsell', value: 72 },
  { label: 'Churn', value: -35 },
  { label: 'Closing', value: 389, total: true },
];

export default function Example() {
  return <WaterfallChart title="Revenue bridge" data={data} />;
}

Data

data takes { label: string; value: number; total?: boolean; color?: string }[]. Input arrays are never mutated and order is preserved.

  • Values are signed changes to a running balance.
  • Set total: true to treat a bar as an absolute balance from zero, such as an opening, subtotal or closing bar.
  • Use negativeColor to change the decline color. The data table and pinned caption include running balances.

Every chart also accepts the common props: description, height, color, variant, animate, formatValue and className.