Waterfall Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Bridges, deltas, and totals stacked as one composable EvilChart
Installation
Usage
The waterfall chart is composible on top of stacked <Bar /> geometries (transparent “base” + visible segment). Provide rows with semantic WaterfallType (start, increase, decrease, total) encoded at typeKey (defaults to "type"), display names (nameKey), deltas (valueKey), gradients via chartConfig. Compose <Grid />, <XAxis />, <YAxis />, <Bars />, <Tooltip />, <Legend /> as needed plus optional backgroundVariant on the root — remaining behavior forwards into Recharts <BarChart />; see BarChart docs when extending through chartProps.
import {
EvilWaterfallChart,
Bars,
Grid,
XAxis,
YAxis,
Tooltip,
Legend,
} from "@/components/evilcharts/charts/waterfall-chart";<EvilWaterfallChart
config={chartConfig}
data={rows}
nameKey="name"
valueKey="amount"
typeKey="type"
backgroundVariant="dots"
>
<Grid vertical={false} />
<XAxis />
<YAxis />
<Bars isClickable glowingBars={["product-a"]} />
<Tooltip />
<Legend isClickable />
</EvilWaterfallChart>Interactive Selection
Set isClickable on <Bars /> and <Legend /> as needed — onSelectionChange carries { dataKey, value } | null, where dataKey aligns with names from nameKey and values reflect stacking math (start resets running totals, totals span full magnitude, deltas offset previous balance):
<EvilWaterfallChart
config={chartConfig}
data={rows}
nameKey="name"
valueKey="amount"
onSelectionChange={(selection) => {
if (selection) {
console.log("Selected:", selection.dataKey, selection.value);
} else {
console.log("Deselected");
}
}}
>
<Grid />
<XAxis />
<YAxis />
<Bars isClickable />
<Legend isClickable />
<Tooltip />
</EvilWaterfallChart>Loading State
The waterfall chart supports loading state. Pass isLoading to shimmer placeholder bars synthesized from seeded loading rows (loadingBars) while real deltas resolve.
Examples
Glowing Bars
API Reference
The chart is composed of several parts. The props below are grouped by the component they belong to.
The root container bridging raw financial rows → cumulative stack-friendly records (base + barValue). Tracks selection highlighting, translucent reference line (y={0}), rounded rect edges, gradients, legends, glowing filters, shimmer skeleton overlays when isLoading.
Configuration slot translating user intent (isClickable, glowingBars) into per-rect handlers + defs.
Cartesian scaffolding with sane defaults balancing dense financial labeling.
Category axis keyed to nameKey, hidden during loading shimmer.
Numeric axis bridging positive / negative deltas with zero reference line synergy.
Selection-aware formatter with subdued crosshair fill (muted translucent band).
Per-bridge legends mirroring clickable selection state.
WaterfallType strings drive preprocessing before bars render (start, increase, decrease, total).