Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Footer
  • MenuNew
  • Navbar
  • On This PageNew
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Button
  • Checkbox
  • Color Picker
    • Date
    • Date Range
    • Datetime
    • Datetime Range
    • Time
    • Time Range
  • File Upload
  • NumericNew
  • Radio Button
  • RatingNew
  • Select
  • Slider
  • Switch
  • Textfield
  • Alert
  • Avatar
  • Chip
  • Icon
  • Progress
  • Skeleton
  • Spinner
  • TooltipNew
  • Data Table
  • Pagination
  • Pick List
  • BarcodeNew
  • QR CodeNew
  • CalendarNew
  • Table
  • Overview
  • Area
  • Bar
  • Box Plot
  • Bullet
  • Bump
  • Candlestick
  • Column
  • Dot Plot
  • Dumbbell
  • Funnel
  • Gantt
  • Gauge
  • Heatmap
  • Histogram
  • Icon
  • Line
  • Lollipop
  • Matrix
  • Nightingale
  • Parallel Coordinates
  • Pie
  • Quadrant
  • Radar
  • Radial Bar
  • Range
  • Scatter
  • Slope
  • Small Multiples
  • Strip Plot
  • Treemap
  • Waffle
  • Waterfall
  • Arc Diagram
  • Barcode
  • Beeswarm
  • Bump Area
  • Categorical Scatter
  • Chord Diagram
  • Circular Treemap
  • Contour
  • Convex Treemap
  • Density Plot
  • Dendrogram
  • Euler Diagram
  • Flowchart
  • Hexagonal Binning
  • Horizon
  • Marimekko
  • Network Diagram
  • Radial Histogram
  • Ridgeline
  • Sankey
  • Stream Graph
  • Sunburst
  • Venn Diagram
  • Violin Plot
  • Word Cloud
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Charts

TwSankeyChart

TwSankeyChart is a Blazor Sankey diagram: nodes in columns joined by ribbons as thick as the flow between them.

Last updated 18 October 2026

Please be aware this component is new, may have bugs and/or be subject to change. Please report any bugs at https://github.com/twblazor/twblazor/issues.

Basic usage

TwSankeyChart arranges ChartGraphNode values in columns and joins them with a ribbon for every ChartGraphLink, as thick as its value. A node sits to the right of every node that flows into it, and is as tall as what flows through it. Links refer to nodes by Id.
Energy flowGigawatt hours
Solar
Wind
Gas
Grid
Homes
Industry
SolarTotal 25→ Grid 25
WindTotal 40→ Grid 40
GasTotal 35→ Grid 35
GridTotal 100→ Homes 45→ Industry 55← Solar 25← Wind 40← Gas 35
HomesTotal 45← Grid 45
IndustryTotal 55← Grid 55
Solar → GridValue 25
Wind → GridValue 40
Gas → GridValue 35
Grid → HomesValue 45
Grid → IndustryValue 55
RAZOR
<TwChart Title="Energy flow" Description="Gigawatt hours">
    <TwSankeyChart Nodes="@_energyNodes" Links="@_energyLinks" />
</TwChart>
CSHARP
@code {
    private readonly ChartGraphNode[] _energyNodes =
    [
        new("solar", "Solar"), new("wind", "Wind"), new("gas", "Gas"),
        new("grid", "Grid"),
        new("homes", "Homes"), new("industry", "Industry")
    ];
    
    private readonly ChartGraphLink[] _energyLinks =
    [
        new("solar", "grid", 25), new("wind", "grid", 40), new("gas", "grid", 35),
        new("grid", "homes", 45), new("grid", "industry", 55)
    ];
}

Several stages

Columns are worked out from the links, so a longer chain simply adds columns. This budget splits income into categories and then into line items, with everything it does not spend flowing to savings.
Where a monthly salary goesPounds
Salary
Bonus
Income
Housing
Living
Savings
Rent
Energy
Food
Travel
Leisure
SalaryTotal ¤3,200→ Income ¤3,200
BonusTotal ¤400→ Income ¤400
IncomeTotal ¤3,600→ Housing ¤1,400→ Living ¤1,300→ Savings ¤900← Salary ¤3,200← Bonus ¤400
HousingTotal ¤1,400→ Rent ¤1,150→ Energy ¤250← Income ¤1,400
LivingTotal ¤1,300→ Food ¤520→ Travel ¤340→ Leisure ¤440← Income ¤1,300
SavingsTotal ¤900← Income ¤900
RentTotal ¤1,150← Housing ¤1,150
EnergyTotal ¤250← Housing ¤250
FoodTotal ¤520← Living ¤520
TravelTotal ¤340← Living ¤340
LeisureTotal ¤440← Living ¤440
Salary → IncomeAmount ¤3,200
Bonus → IncomeAmount ¤400
Income → HousingAmount ¤1,400
Income → LivingAmount ¤1,300
Income → SavingsAmount ¤900
Housing → RentAmount ¤1,150
Housing → EnergyAmount ¤250
Living → FoodAmount ¤520
Living → TravelAmount ¤340
Living → LeisureAmount ¤440
RAZOR
<TwChart Title="Where a monthly salary goes" Description="Pounds">
    <TwSankeyChart Nodes="@_budgetNodes" Links="@_budgetLinks" ValueFormat="C0" SourceHeader="From" TargetHeader="To" ValueHeader="Amount" Height="ChartHeight.Large" />
</TwChart>
CSHARP
@code {
    private readonly ChartGraphNode[] _budgetNodes =
    [
        new("salary", "Salary"), new("bonus", "Bonus"),
        new("income", "Income"),
        new("housing", "Housing"), new("living", "Living"), new("savings", "Savings"),
        new("rent", "Rent"), new("energy", "Energy"), new("food", "Food"), new("travel", "Travel"), new("leisure", "Leisure")
    ];
    
    private readonly ChartGraphLink[] _budgetLinks =
    [
        new("salary", "income", 3200), new("bonus", "income", 400),
        new("income", "housing", 1400), new("income", "living", 1300), new("income", "savings", 900),
        new("housing", "rent", 1150), new("housing", "energy", 250),
        new("living", "food", 520), new("living", "travel", 340), new("living", "leisure", 440)
    ];
}

Setting the column

A node with nothing flowing into it starts in the first column. Set its Stage to move it further right, as with the visitors who join this funnel at the basket from a saved link.
Checkout funnelSessions last week
Home page
Product page
Saved link
Basket
Paid
Abandoned
Home pageTotal 5,200→ Product page 5,200
Product pageTotal 5,200→ Basket 1,900← Home page 5,200
Saved linkTotal 600→ Basket 600
BasketTotal 2,500→ Paid 1,400→ Abandoned 1,100← Product page 1,900← Saved link 600
PaidTotal 1,400← Basket 1,400
AbandonedTotal 1,100← Basket 1,100
Home page → Product pageSessions 5,200
Product page → BasketSessions 1,900
Saved link → BasketSessions 600
Basket → PaidSessions 1,400
Basket → AbandonedSessions 1,100
RAZOR
<TwChart Title="Checkout funnel" Description="Sessions last week">
    <TwSankeyChart Nodes="@_funnelNodes" Links="@_funnelLinks" ValueHeader="Sessions" />
</TwChart>
CSHARP
@code {
    private readonly ChartGraphNode[] _funnelNodes =
    [
        new("home", "Home page"), new("product", "Product page"),
        new("saved", "Saved link", Stage: 1),
        new("basket", "Basket"), new("paid", "Paid"), new("left", "Abandoned")
    ];
    
    private readonly ChartGraphLink[] _funnelLinks =
    [
        new("home", "product", 5200), new("product", "basket", 1900), new("saved", "basket", 600),
        new("basket", "paid", 1400), new("basket", "left", 1100)
    ];
}

When to use

Use a Sankey diagram to show how a quantity divides and recombines as it moves through stages. Links without a positive value are left out.

Summary

Tooltips and the table view give the source, target and value of each link. Tooltips also give the total of each node. The arrow keys visit the nodes first, then the links.

Shared features

The legend, tooltips, keyboard navigation, table view, value formatting, height and empty state work the same on every chart. See TwChart for those options.

Keyboard navigation

The plot is a single Tab stop. Each data point is announced with its series and value as focus reaches it, and the table view presents the same data without the plot.
Key What it does
Tab Moves focus into the plot, onto the data point last visited.
Arrow Right or Arrow Down Moves to the next data point.
Arrow Left or Arrow Up Moves to the previous data point.
Home or End Moves to the first or last data point.
Escape Hides the tooltip of the focused data point.
Enter or Space On a legend item: shows or hides that series. On the table button: switches between the chart and its data table.

On this page

  • Basic usage
  • Several stages
  • Setting the column
  • When to use
  • Summary
  • Shared features
  • Keyboard navigation
Discord (opens in a new tab) • GitHub (opens in a new tab) • Documentation (opens in a new tab) • MIT License (opens in a new tab) • llms.txt (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload