Skip to contentSkip to content

SankeyChart API

API reference docs for the React SankeyChart component. Learn about the props, CSS, and other APIs of this exported module.

Demos

Import

import { SankeyChart } from '@mui/x-charts-pro/SankeyChart';
// or
import { SankeyChart } from '@mui/x-charts-pro';
// or
import { SankeyChart } from '@mui/x-charts-premium/SankeyChart';
// or
import { SankeyChart } from '@mui/x-charts-premium';

Learn about the difference by reading this guide on minimizing bundle size.

Props

NameTypeDefaultDescription
series*SankeySeries-

The series to display in the Sankey chart. A single object is expected.

classesPartial-

Classes applied to the various elements.

See CSS classes API below for more details.

colorsArray<string>
| func
rainbowSurgePalette

Color palette used to colorize multiple series.

descstring-

The description of the chart. Used to provide an accessible description for the chart.

disableKeyboardNavigationbool-

If true, disables keyboard navigation for the chart.

experimentalFeatures{}-

Options to enable features planned for the next major.

heightnumber-

The height of the chart in px. If not defined, it takes the height of the parent element.

highlightedItem{ nodeId: number
| string, seriesId: string, subType: 'node' }
| { nodeId: number
| string, seriesId: string, subType: 'node', type: 'sankey' }
| { seriesId: string, sourceId: number
| string, subType: 'link', targetId: number
| string }
| { seriesId: string, sourceId: number
| string, subType: 'link', targetId: number
| string, type: 'sankey' }
-

The highlighted item. Used when the highlight is controlled.

idstring-

This prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id.

loadingboolfalse

If true, a loading overlay is displayed.

localeTextPartial-

Localized text for chart components.

marginnumber
| { bottom?: number, left?: number, right?: number, top?: number }
-

The margin between the SVG and the drawing area. It's used for leaving some space for extra information such as the x- and y-axis or legend.

Accepts a number to be used on all sides or an object with the optional properties: top, bottom, left, and right.

onHighlightChangefunc-

The callback fired when the highlighted item changes.

Signature:function(highlightedItem: HighlightItemIdentifierWithType<SeriesType> | null) => void
  • highlightedItem The newly highlighted item.
onLinkClickfunc-

Callback fired when a sankey item is clicked.

Signature:function(event: React.MouseEvent<SVGElement, MouseEvent>, link: SankeyLinkIdentifierWithData) => void
  • event The event source of the callback.
  • link The sankey link identifier.
onNodeClickfunc-

Callback fired when a sankey item is clicked.

Signature:function(event: React.MouseEvent<SVGElement, MouseEvent>, node: SankeyNodeIdentifierWithData) => void
  • event The event source of the callback.
  • node The sankey node identifier.
onTooltipItemChangefunc-

The callback fired when the tooltip item changes.

Signature:function(tooltipItem: SeriesItemIdentifier<SeriesType> | null) => void
  • tooltipItem The newly highlighted item.
seriesConfigChartSeriesConfig & ChartSeriesConfig<'sankey'>-

The configuration for the series types. This is used to define how each series type should be processed, colored, and displayed.

slotPropsSankeyChartSlotProps{}

The props used for each component slot.

slotsSankeyChartSlots{}

Overridable component slots.

See Slots API below for more details.

titlestring-

The title of the chart. Used to provide an accessible label for the chart.

tooltipItem{ nodeId: number
| string, seriesId: string, subType: 'node' }
| { nodeId: number
| string, seriesId: string, subType: 'node', type: 'sankey' }
| { seriesId: string, sourceId: number
| string, subType: 'link', targetId: number
| string }
| { seriesId: string, sourceId: number
| string, subType: 'link', targetId: number
| string, type: 'sankey' }
-

The tooltip item. Used when the tooltip is controlled.

widthnumber-

The width of the chart in px. If not defined, it takes the width of the parent element.

The component cannot hold a ref.

Slots

Slot nameClass nameDefault componentDescription
baseButton
baseIconButton
loadingOverlayChartsLoadingOverlayOverlay component rendered when the chart is in a loading state.
noDataOverlayChartsNoDataOverlayOverlay component rendered when the chart has no data to display.
toolbarChartsToolbarCustom component for the toolbar.
tooltipChartsTooltipRootCustom component for the tooltip popper.

Source code

If you did not find the information in this page, consider having a look at the implementation of the component for more detail.