Skip to content
daisyBlazor

SankeyChart

Flows between named stages, each band as wide as its value: signups from source to plan to status, budgets from team to project. D3 places the nodes and bands; the chart draws them in theme colours.
Essentials
Cover · <SankeyChart>
Sankey diagramOrganic to Starter: 320; Organic to Pro: 180; Referral to Pro: 140; Partner to Enterprise: 70; Starter to Active: 250; Starter to Churned: 70; Pro to Active: 290; Pro to Churned: 30; Enterprise to Active: 70Organic → Starter: 320Organic → Pro: 180Referral → Pro: 140Partner → Enterprise: 70Starter → Active: 250Starter → Churned: 70Pro → Active: 290Pro → Churned: 30Enterprise → Active: 70Organic: 500 OrganicStarter: 320 StarterPro: 320 ProReferral: 140 ReferralPartner: 70 PartnerEnterprise: 70 EnterpriseActive: 610 ActiveChurned: 100 Churned

Examples

Basic

Each SankeyLink moves a Value from Source to Target; node names come from the links, and each node shows its total.

Signups by source, plan and status
Signups by source, plan and statusOrganic to Starter: 320; Organic to Pro: 180; Referral to Pro: 140; Referral to Starter: 90; Partner to Enterprise: 70; Partner to Pro: 60; Starter to Active: 460; Starter to Churned: 150; Pro to Active: 330; Pro to Churned: 50; Enterprise to Active: 66; Enterprise to Churned: 4Organic → Starter: 320Organic → Pro: 180Referral → Pro: 140Referral → Starter: 90Partner → Enterprise: 70Partner → Pro: 60Starter → Active: 460Starter → Churned: 150Pro → Active: 330Pro → Churned: 50Enterprise → Active: 66Enterprise → Churned: 4Organic: 500 Organic 500Starter: 610 Starter 610Pro: 380 Pro 380Referral: 230 Referral 230Partner: 130 Partner 130Enterprise: 70 Enterprise 70Active: 856 Active 856Churned: 204 Churned 204
website/Examples/Charts/SankeyChartBasicExample.razor Source

Node colours

NodeColors maps a node name to any CSS colour; ShowValues="false" keeps only the names, and AspectRatio sets the shape.

Sankey diagramTrial to Converted: 512; Trial to Expired: 1,128; Converted to Annual: 190; Converted to Monthly: 322Trial → Converted: 512Trial → Expired: 1,128Converted → Annual: 190Converted → Monthly: 322Trial: 1,640 TrialConverted: 512 ConvertedExpired: 1,128 ExpiredAnnual: 190 AnnualMonthly: 322 Monthly
website/Examples/Charts/SankeyChartColorsExample.razor Source

Playground

Signups by source, plan and status
Signups by source, plan and statusOrganic to Starter: 320; Organic to Pro: 180; Referral to Pro: 140; Referral to Starter: 90; Partner to Enterprise: 70; Partner to Pro: 60; Starter to Active: 460; Starter to Churned: 150; Pro to Active: 330; Pro to Churned: 50; Enterprise to Active: 66; Enterprise to Churned: 4Organic → Starter: 320Organic → Pro: 180Referral → Pro: 140Referral → Starter: 90Partner → Enterprise: 70Partner → Pro: 60Starter → Active: 460Starter → Churned: 150Pro → Active: 330Pro → Churned: 50Enterprise → Active: 66Enterprise → Churned: 4Organic: 500 Organic 500Starter: 610 Starter 610Pro: 380 Pro 380Referral: 230 Referral 230Partner: 130 Partner 130Enterprise: 70 Enterprise 70Active: 856 Active 856Churned: 204 Churned 204
Align SankeyAlign
<SankeyChart
             Title="Signups by source, plan and status"
             Links="@_links" />

@code {
    private readonly SankeyLink[] _links =
    [
        new("Organic", "Starter", 320),
        new("Organic", "Pro", 180),
        new("Referral", "Pro", 140),
        new("Referral", "Starter", 90),
        new("Partner", "Enterprise", 70),
        new("Partner", "Pro", 60),
        new("Starter", "Active", 460),
        new("Starter", "Churned", 150),
        new("Pro", "Active", 330),
        new("Pro", "Churned", 50),
        new("Enterprise", "Active", 66),
        new("Enterprise", "Churned", 4),
    ];
}

API

<SankeyChart>

DaisyBlazor.Charts

Parameters

  • Align SankeyAlign
    = SankeyAlign.Justify

    How nodes without outgoing links are placed in columns.

  • AspectRatio double
    = 1.78

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

  • Links IReadOnlyList<SankeyLink>
    = []

    The flows. Node names come from Source and Target; links without a positive Value are skipped. Cycles are not allowed.

  • NodeColors IReadOnlyDictionary<string, string>
    = null

    Optional colour per node name (any CSS colour); other nodes cycle through the theme palette.

  • NodePadding double
    = 14

    Vertical gap between nodes in the same column, in chart units.

  • NodeWidth double
    = 12

    Width of each node bar, in chart units.

  • 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 node's total after its name.

  • Title string
    = null

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

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

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

  • 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