View as Markdown

API reference: @salmonui/charts/sankey-chart

SankeyChartcomponent

import { SankeyChart } from '@salmonui/charts/sankey-chart';
function SankeyChart(props: SankeyChartProps): ReactNode;

Props: SankeyChartProps

SankeyChart props (33)
NameSignatureDescription
nodesreadonly nodes: readonly SankeyNode[];
linksreadonly links: readonly SankeyLink[];
orientationoptionalreadonly orientation?: 'horizontal' | 'vertical' | undefined;
nodeWidthoptionalreadonly nodeWidth?: number | undefined;

Node thickness across the flow, px. Default 16.

nodePaddingoptionalreadonly nodePadding?: number | undefined;

Gap between nodes in a column, px. Default 12.

linkColoroptionalreadonly linkColor?: 'source' | 'target' | 'gradient' | undefined;

Link color: the source or target node color, or a gradient between them. Default source.

curvatureoptionalreadonly curvature?: number | undefined;

0 (straight) .. 1. Default 0.5.

labelsoptionalreadonly labels?: boolean | { readonly position?: 'inside' | 'outside' | undefined; } | undefined;
legendoptionalreadonly legend?: boolean | { readonly position?: 'top' | 'bottom' | 'start' | 'end' | undefined; readonly title?: string | undefined; } | undefined;
tooltipoptionalreadonly tooltip?: boolean | { readonly renderNode?: ((node: SankeyNodeInfo) => ReactNode) | undefined; readonly renderLink?: ((link: SankeyLinkInfo) => ReactNode) | undefined; } | undefined;
highlightoptionalreadonly highlight?: 'adjacent' | false | undefined;

Dim everything not connected to the hovered or focused node or link. Default adjacent.

onNodeClickoptionalreadonly onNodeClick?: ((node: SankeyNodeInfo, event: SankeyEvent) => void) | undefined;
onLinkClickoptionalreadonly onLinkClick?: ((link: SankeyLinkInfo, event: SankeyEvent) => void) | undefined;
onNodeHoveroptionalreadonly onNodeHover?: ((node: SankeyNodeInfo | null) => void) | undefined;
onLinkHoveroptionalreadonly onLinkHover?: ((link: SankeyLinkInfo | null) => void) | undefined;
getNodeStyleoptionalreadonly getNodeStyle?: ((node: SankeyNodeInfo) => { readonly color?: string | undefined; } | undefined) | undefined;
getLinkStyleoptionalreadonly getLinkStyle?: ((link: SankeyLinkInfo) => { readonly color?: string | undefined; readonly opacity?: number | undefined; } | undefined) | undefined;
formatLabeloptionalreadonly formatLabel?: ((node: SankeyNodeInfo) => string) | undefined;
formatoptionalreadonly format?: Intl.NumberFormatOptions | ((value: number) => string) | undefined;
localeoptionalreadonly locale?: string | undefined;
textoptionalreadonly text?: Partial<SankeyChartText> | undefined;

Built-in text (over the nearest LocaleProvider's sankeyChart entry).

widthoptionalreadonly width?: number | undefined;
heightoptionalreadonly height?: number | undefined;
titleoptionalreadonly title?: string | undefined;
subtitleoptionalreadonly subtitle?: string | undefined;
descriptionoptionalreadonly description?: string | undefined;
showDataTableoptionalreadonly showDataTable?: boolean | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;
idoptionalreadonly id?: string | undefined;
refoptionalreadonly ref?: Ref<SankeyChartApi> | undefined;
onResizeoptionalreadonly onResize?: ((size: { readonly width: number; readonly height: number; }) => void) | undefined;
animatedoptionalreadonly animated?: boolean | undefined;

Entrance and update transitions, default true: client only (never in server markup), off under prefers-reduced-motion. The CSS is the opt-in @salmonui/charts/viz-animations.css.