Perspective - Sankey

Component Palette Icon:
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. This section only documents the props category of properties. The other categories are described on the Perspective Component Properties page.
| Name | Description | Property Type |
|---|---|---|
| data | Sets the node and link arrays displayed on the chart.
| 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.
| object |
| labels | Label configuration for nodes and links.
| object |
| title | Chart title and subtitle configuration. Options include:
| object |
| tooltip | The tooltip shown on hover. Configuration options include:
| object |
| interaction | User interaction options:
| object |
| appearance | Visual style configuration:
| object |
| style | Sets a style for this chart. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class. | 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:
| 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:
| 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β
Further component interaction and functionality can be configured for all components through scripting and event actions. Right-click on the component or select Components from the Designer menubar to access the configuration popups for both of these options:
- Configure Events: Accesses the Event Configuration popup where you can configure actions to run in response to events to make the component dynamic. The Events Configurations page shows how to configure events and actions on a Perspective component.
- Configure Scripts: Accesses the Script Configuration popup where custom methods and message handlers can be added. The Scripting in Perspective section details scripting fundamentals, creating custom methods, and using message handlers.
The Sankey component also has Component Events associated with it. See the Perspective - Sankey Scripting 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.

[
{
"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"
}
}
}
]