Waterfall chart — cumulative positive/negative bars — pure SVG, zero JS.
Each bar floats at the cumulative total of previous bars. Positive steps
use positive_color, negative steps use negative_color. An optional
final bar rendered in total_color shows the aggregate sum.
Examples
<.waterfall_chart data={[
%{label: "Revenue", value: 500},
%{label: "COGS", value: -200},
%{label: "Gross", value: 0, total: true},
%{label: "OpEx", value: -120},
%{label: "EBIT", value: 0, total: true}
]} />
Summary
Functions
Attributes
data(:list) (required) - List of%{label, value}. Optional:totalboolean marks a bar that resets to the running sum (shown intotal_color).positive_color(:string) - Color for gains. Defaults to"oklch(0.70 0.18 145)".negative_color(:string) - Color for losses. Defaults to"oklch(0.60 0.25 0)".total_color(:string) - Color for total bars. Defaults to"oklch(0.60 0.20 240)".show_grid(:boolean) - Defaults totrue.show_labels(:boolean) - Defaults totrue.animate(:boolean) - Defaults totrue.animation_duration(:integer) - Defaults to600.theme(:map) - Chart theme overrides. Defaults to%{}.id(:string) - Unique ID for the chart (auto-generated if not provided). Defaults tonil.title(:string) - Chart title rendered above the visualization. Defaults tonil.description(:string) - Chart description for context (rendered below title). Defaults tonil.class(:string) - Defaults tonil.Global attributes are accepted.