View as Markdown

API reference: @salmonui/charts/sankey-chart

SankeyChartPropsinterface

import type { SankeyChartProps } from '@salmonui/charts/sankey-chart';
interface SankeyChartProps {
    readonly nodes: readonly SankeyNode[];
    readonly links: readonly SankeyLink[];
    readonly orientation?: 'horizontal' | 'vertical' | undefined;
    readonly nodeWidth?: number | undefined;
    readonly nodePadding?: number | undefined;
    readonly linkColor?: 'source' | 'target' | 'gradient' | undefined;
    readonly curvature?: number | undefined;
    readonly labels?: boolean | {
        readonly position?: 'inside' | 'outside' | undefined;
    } | undefined;
    readonly legend?: boolean | {
        readonly position?: 'top' | 'bottom' | 'start' | 'end' | undefined;
        readonly title?: string | undefined;
    } | undefined;
    readonly tooltip?: boolean | {
        readonly renderNode?: ((node: SankeyNodeInfo) => ReactNode) | undefined;
        readonly renderLink?: ((link: SankeyLinkInfo) => ReactNode) | undefined;
    } | undefined;
    readonly highlight?: 'adjacent' | false | undefined;
    readonly onNodeClick?: ((node: SankeyNodeInfo, event: SankeyEvent) => void) | undefined;
    readonly onLinkClick?: ((link: SankeyLinkInfo, event: SankeyEvent) => void) | undefined;
    readonly onNodeHover?: ((node: SankeyNodeInfo | null) => void) | undefined;
    readonly onLinkHover?: ((link: SankeyLinkInfo | null) => void) | undefined;
    readonly getNodeStyle?: ((node: SankeyNodeInfo) => {
        readonly color?: string | undefined;
    } | undefined) | undefined;
    readonly getLinkStyle?: ((link: SankeyLinkInfo) => {
        readonly color?: string | undefined;
        readonly opacity?: number | undefined;
    } | undefined) | undefined;
    readonly formatLabel?: ((node: SankeyNodeInfo) => string) | undefined;
    readonly format?: Intl.NumberFormatOptions | ((value: number) => string) | undefined;
    readonly locale?: string | undefined;
    readonly text?: Partial<SankeyChartText> | undefined;
    readonly width?: number | undefined;
    readonly height?: number | undefined;
    readonly title?: string | undefined;
    readonly subtitle?: string | undefined;
    readonly description?: string | undefined;
    readonly showDataTable?: boolean | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly id?: string | undefined;
    readonly ref?: Ref<SankeyChartApi> | undefined;
    readonly onResize?: ((size: {
        readonly width: number;
        readonly height: number;
    }) => void) | undefined;
    readonly animated?: boolean | undefined;
}
SankeyChartProps members (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.