Skip to content
daisyBlazor

WaterfallChart

How a total gets from one value to another: a starting count, the changes that raise or lower it, optional subtotals and the closing count, such as customers gained and lost over a quarter. Increases are green, decreases red, totals in the primary colour. D3 computes the running totals and the scales.
Composition and progress
Cover · <WaterfallChart>
Waterfall chartStart: 1,240; New: +310 (total 1,550); Back: +42 (total 1,592); Lost: -96 (total 1,496); End: 1,496StartNewBackLostEnd05001,0001,500Start: 1,240New: +310 (total 1,550)Back: +42 (total 1,592)Lost: -96 (total 1,496)End: 1,496

Examples

Basic

A Start step sets the opening total, each Delta step adds its Value (negative to subtract), and an End step draws where it lands. Dashed rules carry each total across to the next bar.

Customers over the quarter
Customers over the quarterJuly 1: 1,240; New signups: +310 (total 1,550); Reactivated: +42 (total 1,592); Churned: -96 (total 1,496); Merged: -12 (total 1,484); Sept 30: 1,484July 1New signupsReactivatedChurnedMergedSept 3005001,0001,500July 1: 1,2401,240New signups: +310 (total 1,550)+310Reactivated: +42 (total 1,592)+42Churned: -96 (total 1,496)-96Merged: -12 (total 1,484)-12Sept 30: 1,4841,484
website/Examples/Charts/WaterfallChartBasicExample.razor Source

Subtotals, sideways

Subtotal steps draw the running total part way through; Horizontal lays the bars out top to bottom with room for longer names.

Waterfall chartJuly 1: 1,240; July signups: +120 (total 1,360); July churn: -34 (total 1,326); August 1: 1,326; August signups: +98 (total 1,424); August churn: -41 (total 1,383); September 1: 1,383; Sept. signups: +92 (total 1,475); Sept. churn: -21 (total 1,454); Sept 30: 1,45405001,0001,500July 1July signupsJuly churnAugust 1August signupsAugust churnSeptember 1Sept. signupsSept. churnSept 30July 1: 1,2401,240July signups: +120 (total 1,360)+120July churn: -34 (total 1,326)-34August 1: 1,3261,326August signups: +98 (total 1,424)+98August churn: -41 (total 1,383)-41September 1: 1,3831,383Sept. signups: +92 (total 1,475)+92Sept. churn: -21 (total 1,454)-21Sept 30: 1,4541,454
website/Examples/Charts/WaterfallChartSubtotalsExample.razor Source

Playground

Customers over the quarter
Customers over the quarterJuly 1: 1,240; New signups: +310 (total 1,550); Reactivated: +42 (total 1,592); Churned: -96 (total 1,496); Merged: -12 (total 1,484); Sept 30: 1,484July 1New signupsReactivatedChurnedMergedSept 3005001,0001,500July 1: 1,2401,240New signups: +310 (total 1,550)+310Reactivated: +42 (total 1,592)+42Churned: -96 (total 1,496)-96Merged: -12 (total 1,484)-12Sept 30: 1,4841,484
<WaterfallChart
                ValueFormat="{0:N0}"
                Title="Customers over the quarter"
                Steps="@_steps" />

@code {
    private readonly WaterfallStep[] _steps =
    [
        new("July 1", 1_240, WaterfallStepKind.Start),
        new("New signups", 310),
        new("Reactivated", 42),
        new("Churned", -96),
        new("Merged", -12),
        new("Sept 30", 0, WaterfallStepKind.End),
    ];
}

API

<WaterfallChart>

DaisyBlazor.Charts

Parameters

  • AspectRatio double
    = 1.78

    Width divided by height. The chart keeps this shape at any width; its text keeps its size.

  • DecreaseColor string
    = "var(--color-error)"

    CSS colour of decreases.

  • Horizontal bool
    = false

    Lay the bars out top to bottom, with the categories down the left side.

  • IncreaseColor string
    = "var(--color-success)"

    CSS colour of increases.

  • RowHeight double?
    = null

    Height of each row in px, for a chart that lays its categories out as rows (horizontal bars, a Gantt's lanes, a heatmap's rows…): its height then follows its number of rows instead of AspectRatio, so a long list keeps readable rows at any width. A chart, or an orientation, without rows ignores it.

  • ShowTitle bool
    = true

    Draw Title as a visible heading above the chart (the default); false keeps it only as the chart's accessible name, for a chart inside a card that already has a heading.

  • ShowValues bool
    = true

    Print each bar's value (signed for changes) next to it.

  • Steps IReadOnlyList<WaterfallStep>
    = []

    The bars, in order: usually a Start, Delta changes, optional Subtotal steps and an End.

  • Title string
    = null

    Optional heading rendered above the chart; it is also the chart's accessible name.

  • TotalColor string
    = "var(--color-primary)"

    CSS colour of the start, subtotal and end bars.

  • ValueFormat string
    = "{0:#,0.##}"

    Format string for values in labels, ticks and tooltips, e.g. "{0:N0}".

  • Width string
    = "100%"

    CSS width of the chart wrapper.

  • Class string
    = null

    Additional CSS classes merged onto the w-full wrapper.

  • Style string
    = null

    Inline styles appended after the width on the wrapper.

Something went wrong while running the docs. Reload