Docs menu

Sankey

The Ninth Forge Sankey (nf_NinthForge.Sankey) shows how amounts flow from one stage to the next, with each ribbon as wide as its amount: an income statement, a sales pipeline, or a mine’s material flow. It’s a Charts Pro control: without a key it works fully and shows a small watermark.

A Sankey chart of where revenue goes, flowing from revenue streams through gross profit and operating costs to net profit, with values on each flow.

Set it up

  1. Make a view with one row per flow: a From column, a To column and a Value column. From and To can be text, choice, lookup or yes/no columns.
  2. Put the control on the view (model-driven apps) or bind it to the table (canvas apps), and map the three columns.
  3. Optional: set Stage headings to names for the stages, left to right, separated by commas, such as Region, Channel.

Rows with the same From and To are added up. Leave Value unmapped to count rows instead. A node that is both a To and a From continues to the next stage, so you can have any number of stages: the number of columns follows the longest path.

A flow is left out if its value is zero or less, if it goes from a node to itself, or if it would close a loop. The control reads up to 50,000 rows.

Using it

  • Flow labels show values, % of source, % of total, or nothing (None). A label only goes inside a ribbon thick enough to hold it.
  • Flow colour is a gradient from source to target, or the source colour.
  • Click a node to trace its flows: everything else fades. Click it again, or press Esc, to show everything. You can also Tab to a node and press Enter.
  • Click a ribbon to select that flow. With the keyboard, Tab to the flows, move between them with the arrow keys, Home and End, and press Enter or Space to select one. Screen readers announce each flow as from, to, value and share of the total.
  • Hover over a ribbon to see its value and its share of the source, the target and the total.

When you select a node or a flow, selectedFrom, selectedTo, selectedValue and selectedRecordIds (JSON) update, and OnSelect runs. A selected node gives its name in selectedFrom and leaves selectedTo empty.

Each node has a label with its name, value and share of the total. Labels move apart so none overlap. A label that can’t find room is left out, but screen readers still read the node’s name, value and share.

For every setting, see Properties.

In code

import { Chart } from '@ninthforge/charts';

<Chart type="sankey" links={[{ source: 'North', target: 'Online', value: 420 }, { source: 'North', target: 'Retail', value: 310 }]} />;

In code apps the Sankey is a Chart type. <Chart type="sankey" /> takes links, or chart data where the category is the source and the series is the target. The sankey prop sets the flow labels, flow colour and stage headings.

Last updated