All docs
V19.2
24.2
The page you are viewing does not exist in version 24.2.
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

JavaScript/jQuery Sankey API

The Sankey is a widget that visualizes the flow magnitude between value sets. The values being connected are called nodes; the connections - links. The higher the flow magnitude, the wider the link is.

import Sankey from "devextreme/viz/sankey"
Type:

Object

Options

This section describes options that configure the Sankey widget's contents, behavior and appearance.

Name Description
adaptiveLayout

Specifies adaptive layout options.

alignment

Aligns node columns vertically.

dataSource

Binds the widget to data.

disabled

Specifies whether the widget responds to user interaction.

elementAttr

Specifies the attributes to be attached to the widget's root element.

export

Configures the exporting and printing features.

hoverEnabled

Specifies whether nodes and links change their style when they are hovered over or pressed.

label

Configures sankey nodes' labels.

link

Configures sankey links' appearance.

loadingIndicator

Configures the loading indicator.

margin

Generates space around the widget.

node

Configures sankey nodes' appearance.

onDisposing

A function that is executed before the widget is disposed of.

onDrawn

A function that is executed when the widget's rendering has finished.

onExported

A function that is executed after the widget is exported.

onExporting

A function that is executed before the widget is exported.

onFileSaving

A function that is executed before a file with exported widget is saved to the user's local storage.

onIncidentOccurred

A function that is executed when an error or warning occurs.

onInitialized

A function used in JavaScript frameworks to save the widget instance.

onLinkClick

A function that is executed when a sankey link is clicked or tapped.

onLinkHoverChanged

A function that is executed after the pointer enters or leaves a sankey link.

onNodeClick

A function that is executed when a sankey node is clicked or tapped.

onNodeHoverChanged

A function that is executed after the pointer enters or leaves a sankey node.

onOptionChanged

A function that is executed after a widget option is changed.

palette

Sets the palette to be used to colorize sankey nodes.

paletteExtensionMode

Specifies how to extend the palette when it contains less colors than the number of sankey nodes.

pathModified

Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path.

redrawOnResize

Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates.

rtlEnabled

Switches the widget to a right-to-left representation.

size

Specifies the widget's size in pixels.

sortData

Specifies nodes' sorting order in their columns.

sourceField

Specifies which data source field provides links' source nodes.

targetField

Specifies which data source field provides links' target nodes.

theme

Sets the name of the theme the widget uses.

title

Configures the widget's title.

tooltip

Configures tooltips - small pop-up rectangles that display information about a data-visualizing widget element being pressed or hovered over with the mouse pointer.

weightField

Specifies which data source field provides links' weights.

See Also

Methods

This section describes the methods that control the Sankey widget.

Name Description
beginUpdate()

Prevents the widget from refreshing until the endUpdate() method is called.

dispose()

Disposes of all the resources allocated to the Sankey instance.

element()

Gets the root widget element.

endUpdate()

Refreshes the widget after a call of the beginUpdate() method.

exportTo(fileName, format)

Exports the widget.

getAllLinks()

Gets all sankey links.

getAllNodes()

Gets all sankey nodes.

getDataSource()

Gets the DataSource instance.

getInstance(element)

Gets the instance of a widget found using its DOM node.

getSize()

Gets the current widget size.

hideLoadingIndicator()

Hides the loading indicator.

hideTooltip()

Hides all widget tooltips.

instance()

Gets the widget's instance. Use it to access other methods of the widget.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all widget options.

option(optionName)

Gets the value of a single option.

option(optionName, optionValue)

Updates the value of a single option.

option(options)

Updates the values of several options.

print()

Opens the browser's print window.

render()

Redraws the widget.

resetOption(optionName)

Resets an option to its default value.

showLoadingIndicator()

Shows the loading indicator.

svg()

Gets the widget's SVG markup.

See Also

Events

This section describes events that the Sankey widget raises.

Name Description
disposing

Raised before the widget is disposed of.

drawn

Raised when the widget's rendering has finished.

exported

Raised after the widget is exported.

exporting

Raised before the widget is exported.

fileSaving

Raised before a file with exported widget is saved to the user's local storage.

incidentOccurred

Raised when an error or warning occurs.

initialized

Raised only once, after the widget is initialized.

linkClick

Raised when a sankey link is clicked or tapped.

linkHoverChanged

Raised after the pointer enters or leaves a sankey link.

nodeClick

Raised when a sankey node is clicked or tapped.

nodeHoverChanged

Raised after the pointer enters or leaves a sankey node.

optionChanged

Raised after a widget option is changed.

See Also

Node

A sankey node's structure.

You can use the getAllNodes() method and event handlers to access nodes, for example, onNodeClick.

Link

A sankey link's structure.

You can access links using the getAllLinks() method and within some event handlers, for example, onLinkClick.