Skip to content

Learn

Sankey diagram syntax

Learn sankey CSV flows (source, target, value) used in the Budget allocation template.

On this page7 sections
  1. Syntax cheatsheet
  2. 1.Start a Sankey diagram
  3. 2.Source, target, value
  4. 3.Labels with commas
  5. 4.Sankey vs pie
  6. 5.Put it together: Budget allocation
  7. Check your level

Syntax cheatsheet

Quick reference for this diagram type

ConceptSyntax
Declaresankey · sankey-beta
Flow rowBudget,Engineering,50
Columnssource,target,value
Quotes"Heating, homes",Grid,10
  1. 1

    Start a Sankey diagram

    Begin with sankey (or sankey-beta). The next non-empty lines are CSV flows — not Mermaid nodes.

    Sankey diagrams are Preview-only in SayDiagram — Present reveals flows row by row.

    sankey
    
    A,B,10
    A,C,20
    Expand
  2. 2

    Source, target, value

    Each row is source,target,value. Values are numeric magnitudes (not required to sum to 100).

    Empty lines are allowed for readability. Comment lines starting with %% are ignored.

    sankey
    
    Budget,Engineering,50
    Budget,Design,20
    Budget,Marketing,30
    Expand
  3. 3

    Labels with commas

    Quote a label when it contains a comma so the CSV parser keeps three columns.

    Reuse the same node name across rows to merge flows into one node.

    sankey
    
    "Heating, homes",Grid,40
    Grid,Exports,10
    Grid,Local,30
    Expand
  4. 4

    Sankey vs pie

    Use pie for shares of one whole. Use sankey when value moves from category to category (budget → teams → workstreams).

    Idea Auto prefers sankey for multi-hop flows and pie for simple mix charts.

    sankey
    
    Budget,Engineering,50
    Engineering,Backend,30
    Engineering,Frontend,20
    Expand
  5. 5

    Put it together: Budget allocation

    Combine budget splits into teams and workstreams — the same pattern as the Examples gallery template.

    • Tip: Present mode reveals one flow per slide so you can walk the allocation live.
    sankey
    
    Budget,Engineering,50
    Budget,Design,20
    Budget,Marketing,30
    Engineering,Backend,30
    Engineering,Frontend,20
    Marketing,Ads,18
    Marketing,Content,12
    Expand

Check your level

80% or higher certifies this lesson. You'll get 35 random questions from a larger bank.