--- title: "Perspective - Sankey" description: "Visualizes directional flow between stages, categories, or systems." --- # Perspective - Sankey > Visualizes directional flow between stages, categories, or systems. ![The default Perspective Sankey chart component.](imgs/sankey-chart-default.png) **Component Palette Icon:** ![The Sankey chart component icon shown in the Perspective Components panel and Project Browser.](imgs/sankey-chart-icon.png) The Sankey component visualizes directional flow between stages, categories, or systems where each link width represents quantity. Data is displayed with node entities grouped by levels, and links that correlate node sources and targets to show the volume moving between them. This type of chart is recommended for tracking energy flow, material flow, and process yield diagrams. ## Properties Most Properties have binding options. For more information on bindings, see [Types of Bindings in Perspective](ignition-modules\perspective\working-with-perspective-components\bindings-in-perspective\bindings-in-perspective.md). This section only documents the `props` category of properties. The other categories are described on the [Perspective Component Properties](ignition-modules\perspective\working-with-perspective-components\perspective-component-properties.md) page. |Name|Description|Property Type| |---|---|---| |data|Sets the node and link arrays displayed on the chart.**nodes**: Entity description configuration. **name**: Unique node identifier and display label. Referenced by `links[x].source` and `links[x].target`. Value is string.**level**: Column position. Overrides automatic layout placement. Columns are 0-indexed. Value is numeric.**links**: Describe the flow between nodes with the following properties:**source**: Name of the source node. Must match a node name in `data.nodes[x]`. Value is string.**target**: Name of the target node. Must match a node name in `data.nodes[x]`. Value is string.**value**: The flow quantity, which determines the link width. Value is numeric. | object| |levels|Column-level style overrides. All nodes at a given level inherit these styles, unless overriden at the node level.| array| |layout| Layout engine configuration for the directional flow diagram. **direction**: The flow direction, where `horizontal` renders from left to right, and `vertical` renders from top to bottom. Value is string.**nodeWidth**: Width of node rectangles in pixels. Value is numeric.**nodeGap**: Vertical gap, in pixels, between nodes in the same column. Value is numeric.**iterations**: Number of layout passes. Higher values produce a more stable layout at the cost of render time. Value is numeric.|object| |labels| Label configuration for nodes and links.**node**: Node label configuration. See [labels.node Properties](#labelsnode-properties) for property information.**link**: Link label configuration. See [labels.link Properties](#labelslink-properties) for property information.**level**: Column header configuration. Text per column comes from `levels[x].label`. Only levels with a label produce a header. See [labels.level Properties](#labelslevel-properties) for property information. | object| |title|Chart title and subtitle configuration. Options include:**visible**: Shows or hides the title. Value is boolean. **position**: Horizontal alignment of the title within the chart. Value is string.**gap**: Pixel gap between the main title and subtitle. Value is numeric.**text**: Main title text.**subtitle**: The subtitles displayed below the main title.**text**: The subtitle text. Value is string.**color**: The color of the subtitle text. Takes precedence over `elementStyle.color` when both are set.**fontSize**: The font size of the subtitle text. Takes precedence over `elementStyle.fontSize` when both are set. Value is numeric.**elementStyle**: Text style for a label rendered onto a chart canvas, including typography, alignment, pill/chip box styling, and shadow.**color**: The color of the main title text. Takes precedence over `elementStyle.color` when both are set.**fontSize**: The font size of the main title text. Takes precedence over `elementStyle.fontSize` when both are set. Value is numeric.**elementStyle**: Text style for a label rendered onto a chart canvas, including typography, alignment, pill/chip box styling, and shadow. | object| |tooltip|The tooltip shown on hover. Configuration options include: **enabled**: Shows the tooltip when true. Value is boolean. **nodeFormat**: The tooltip text for nodes. Takes precedence over the default tooltip when both are set. Available tokens include `{name}`, `{value}`, and `{flow}`. Value is string.**linkFormat**: The tooltip text for links. Takes precedence over the default tooltip when both are set. Available tokens include `{name}` and `{value}`. Value is string. | object| |interaction|User interaction options: **draggable**: Allows users to drag nodes to reposition them. Value is boolean.**focusOnHover**: Highlights the hovered node and its connected links, will dim everything else. Value is boolean.| object| |appearance|Visual style configuration: **colorPalette**: Colors auto-assigned to nodes that do not have an explicit `data.color`. Assigned in `data.nodes[x]` array order. Defaults to the Ignition theme palette. Value is array.**linkOpacity**: Global link opacity between 0 and 1. Lower values reduce visual noise on dense charts. Value is numeric.**linkColorMode**: Determines how the link color is derived. Value is string. Options include:**source**: Inherits the source node color.**target**: Inherits the target node color.**gradient**: Blends the source to target colors.**fixed**: Uses the first color in the `colorPalette` property.**padding**: Pushes the chart's plotting area in from the container edges. Use to make room for a title so it doesn't overlap the diagram. Each side falls back to its own default when left empty. Value is numeric for each `top`, `left`, `right`, and `bottom` property.**backgroundColor**: Chart background fill. **animation**: Enables chart animation on render and when its data changes. Value is boolean. | object| |style|Sets a style for this chart. Full menu of [style options](appendix\reference-pages\style-reference.md) is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a [style class](ignition-modules\perspective\styles\style-classes\style-classes.md).|object| ### labels.node Properties |Name|Description|Property Type| |---|---|---| |visible| Shows or hides node labels. True by default. | boolean| |position| Label placement relative to the node. Options include: `right``left``top``bottom``inside`| string| |format| Custom format expression for node label text. Tokens include `{name}` and `{value}`.|string| |fontSize| Font size of node labels in pixels. Takes precedence over `elementStyle.fontSize` when both are set.| numeric| |elementStyle|Text style for a label rendered onto a chart canvas, including typography, alignment, pill/chip box styling, and shadow.|object| ### labels.link Properties |Name|Description|Property Type| |---|---|---| |visible| Shows or hides the link labels. False by default. | boolean| |format| Custom format expression for link label text. Tokens include `{name}` and `{value}`. |string| |fontSize| Font size of link labels in pixels. Takes precedence over `elementStyle.fontSize` when both are set.| numeric| |elementStyle|Text style for a label rendered onto a chart canvas, including typography, alignment, pill/chip box styling, and shadow.|object| ### labels.level Properties |Name|Description|Property Type| |---|---|---| |visible| Shows or hides the column headers. True by default. | boolean| |position| Determines the edge the column headers are anchored to. Options include: `right``left``top``bottom`| string| |padding|The distance from the anchored edge, as pixels or a percentage of the container's matching dimension.|numeric| |color|The color of the column header text. Takes precedence over `elementStyle.color` when both are set.| color| |fontSize|Font size of the column headers in pixels. Takes precedence over `elementStyle.fontSize` when both are set.| numeric| |elementStyle|Text style for a label rendered onto a chart canvas, including typography, alignment, pill/chip box styling, and shadow.|object| ## Component Scripts and Events The Sankey component also has Component Events associated with it. See the [Perspective - Sankey Scripting](perspective-sankey-scripting.md) page for more information. ## Chart Example The following chart example uses the default data for the Sankey chart, with the exception of the buildings data node. The overall appearance has also been updated with `gradient` selected as the `linkColorMode` and `title` and `subtitle` text added to the top right corner. The included image shows how the chart's appearance changes with `focusOnHover` enabled and the `tooltip.nodeFormat` configured to display the node value. The sample values used in this example are listed below in JSON format. ![A Sankey chart highlighting an energy flow of 117 from a Transport node to Electricity and Oil nodes, where the value splits to 22 and 95, respectively.](imgs/energy-flow-sankey-example.png) ```JSON title="Sankey Chart Sample Data" [ { "props": { "data": { "nodes": [ { "level": 0, "name": "Coal" }, { "level": 0, "name": "Natural Gas" }, { "level": 0, "name": "Renewables" }, { "level": 0, "name": "Nuclear" }, { "level": 0, "name": "Oil" }, { "level": 1, "name": "Electricity" }, { "level": 2, "name": "Buildings" }, { "level": 2, "name": "Transport" } ], "links": [ { "source": "Coal", "target": "Electricity", "value": 70 }, { "source": "Coal", "target": "Industry", "value": 35 }, { "source": "Natural Gas", "target": "Electricity", "value": 45 }, { "source": "Natural Gas", "target": "Industry", "value": 40 }, { "source": "Natural Gas", "target": "Buildings", "value": 20 }, { "source": "Oil", "target": "Transport", "value": 95 }, { "source": "Oil", "target": "Industry", "value": 30 }, { "source": "Renewables", "target": "Electricity", "value": 40 }, { "source": "Nuclear", "target": "Electricity", "value": 28 }, { "source": "Electricity", "target": "Industry", "value": 55 }, { "source": "Electricity", "target": "Buildings", "value": 60 }, { "source": "Electricity", "target": "Transport", "value": 22 } ] }, "layout": { "nodeWidth": 30 }, "labels": { "node": { "format": "{name}" }, "link": { "visible": true, "format": "{value}" } }, "title": { "position": "top-right", "text": "Energy Flow", "subtitle": { "text": "Production and Consumption" }, "fontSize": 40 }, "tooltip": { "nodeFormat": "{value}" }, "appearance": { "linkColorMode": "gradient", "backgroundColor": "#FFFFFF" } } } ] ```