import { D3ZoomEvent } from 'd3-zoom'; import { ComponentConfigInterface } from '../../core/component/config'; import { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from '../../types/accessor'; import { FillPatternType } from '../../styles/patterns'; import { TrimMode, VerticalAlign, FitMode } from '../../types/text'; import { Position } from '../../types/position'; import { Spacing } from '../../types/spacing'; import { SankeyInputLink, SankeyInputNode, SankeyNodeAlign, SankeySubLabelPlacement, SankeyExitTransitionType, SankeyEnterTransitionType, SankeyLink, SankeyNode, SankeyZoomMode } from './types'; export interface SankeyConfigInterface extends ComponentConfigInterface { /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */ id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string; /** Coefficient to scale the height of the diagram when the amount of links is low: `C * links.length`, clamped to `[height / 2, height]`. Default: `1/16` */ heightNormalizationCoeff?: number; /** Horizontal and vertical scale factor applied to the computed layout (column spacing). Keeps node width intact. Default: `undefined` */ zoomScale?: [number, number]; /** Pan offset in pixels. Default: `undefined` */ zoomPan?: [number, number]; /** Enable interactive zoom/pan behavior. Default: `true` */ enableZoom?: boolean; /** Allowed interactive zoom scale extent. Default: `[1, 5]` */ zoomExtent?: [number, number]; /** Zoom interaction mode. Default: `SankeyZoomMode.XY` */ zoomMode?: SankeyZoomMode | string; /** Disable modifier keys. Has effect only for `SankeyZoomMode.XY` zoom mode. When `true`, zoom mode is not altered by modifier keys. Default: `false` */ disableZoomModifierKeys?: boolean; /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */ exitTransitionType?: SankeyExitTransitionType; /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */ enterTransitionType?: SankeyEnterTransitionType; /** Highlight the corresponding subtree on node / link hover. Default: `false` */ highlightSubtreeOnHover?: boolean; /** Highlight animation duration, ms. Default: `400` */ highlightDuration?: number; /** Highlight delay, ms. Default: `1000` */ highlightDelay?: number; /** Sankey algorithm iterations. Default: `32` */ iterations?: number; /** Sankey node sorting function. Default: `undefined`. * Node sorting is applied to nodes in one layer (column). Layer by layer. * Options: `undefined` - the order is determined by the layout; * `null` - the order is fixed by the input; * sort function - the order is determined by the function. */ nodeSort?: ((node1: SankeyNode, node2: SankeyNode) => number) | null | undefined; /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`. * Link sorting is applied to the source (exiting) links within one node. * Options: `undefined` - the order is determined by the layout; * `null` - the order is fixed by the input; * sort function - the order is determined by the function. */ linkSort?: ((link1: SankeyLink, link2: SankeyLink) => number) | null | undefined; /** Sankey node width in pixels */ nodeWidth?: number; /** Sankey node alignment method */ nodeAlign?: SankeyNodeAlign; /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */ nodeHorizontalSpacing?: number; /** Minimum node height. Extended Sizing property only. Default: `20` */ nodeMinHeight?: number; /** Maximum node height. Extended Sizing property only. Default: `100` */ nodeMaxHeight?: number; /** Sankey vertical separation between nodes in pixels. Default: `2` */ nodePadding?: number; /** Compress `nodePadding` when it doesn't fit the available height, so that node bodies * always keep at least a third of it instead of collapsing to zero height. * Applied only when `Sizing.Fit` is selected. Default: `false` */ nodeAdaptivePadding?: boolean; /** Display the graph when data has just one element */ showSingleNode?: boolean; /** Node cursor on hover. Default: `undefined` */ nodeCursor?: StringAccessor>; /** Node icon accessor function or value. Default: `undefined` */ nodeIcon?: StringAccessor>; /** Node color accessor function or value. Default: `undefined` */ nodeColor?: ColorAccessor>; /** Node fill pattern accessor. Resolves to a `FillPatternType`. Default: `undefined` */ nodePattern?: GenericAccessor>; /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`). * Default: `n => n.fixedValue` */ nodeFixedValue?: NumericAccessor; /** Icon color accessor function or value. Default: `undefined` */ nodeIconColor?: ColorAccessor>; /** Link color accessor function or value. Default: `l => l.color` */ linkColor?: StringAccessor>; /** Link fill pattern accessor. Resolves to a `FillPatternType`. Default: `undefined` */ linkPattern?: GenericAccessor>; /** Link flow accessor function or value. Default: `l => l.value` */ linkValue?: NumericAccessor; /** Link cursor on hover. Default: `undefined` */ linkCursor?: StringAccessor>; /** Node label accessor function or value. Default: `n => n.label` */ label?: StringAccessor>; /** Node sub-label accessor function or value. Default: `undefined` */ subLabel?: StringAccessor>; /** Label position relative to the Node. Default: `Position.AUTO` */ labelPosition?: GenericAccessor>; /** Label vertical alignment */ labelVerticalAlign?: VerticalAlign | string; /** Label background */ labelBackground?: boolean; /** Label fit mode (wrap or trim). Default: `FitMode.Trim` **/ labelFit?: FitMode; /** Maximum label with in pixels. Default: `70` */ labelMaxWidth?: number; /** Whether to take the available space for the label. This property is used only if `labelMaxWidth` is not provided. Default: `false` */ labelMaxWidthTakeAvailableSpace?: boolean; /** Tolerance for the available space for the label. This property is used only if `labelMaxWidthTakeAvailableSpace` is `true`. Default: `undefined` (use label and sub-label font sizes) */ labelMaxWidthTakeAvailableSpaceTolerance?: number; /** Expand trimmed label on hover. Default: `true` */ labelExpandTrimmedOnHover?: boolean; /** Label trimming mode. Default: `TrimMode.Middle` */ labelTrimMode?: TrimMode; /** Label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-label-font-size` will be used. Default: `undefined` */ labelFontSize?: number; /** Label text separators for wrapping. Default: `[' ', '-']` */ labelTextSeparator?: string[]; /** Label text decoration. Default: `undefined` */ labelTextDecoration?: StringAccessor>; /** Force break words to fit long labels. Default: `true` */ labelForceWordBreak?: boolean; /** Label color. Default: `undefined` */ labelColor?: ColorAccessor>; /** Label cursor on hover. Default: `undefined` */ labelCursor?: StringAccessor>; /** Custom function to set the label visibility. Default: `undefined` */ labelVisibility?: ((d: SankeyNode, bbox: { x: number; y: number; width: number; height: number; }, hovered: boolean) => boolean) | undefined; /** Sub-label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-sublabel-font-size` will be used. Default: `undefined` */ subLabelFontSize?: number; /** Sub-label color. Default: `undefined` */ subLabelColor?: ColorAccessor>; /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */ subLabelPlacement?: SankeySubLabelPlacement | string; /** Sub-label text decoration. Default: `undefined` */ subLabelTextDecoration?: StringAccessor>; /** * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline` * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label. */ subLabelToLabelInlineWidthRatio?: number; /** Zoom event callback. Default: `undefined` */ onZoom?: (horizontalScale: number, verticalScale: number, panX: number, panY: number, zoomExtent: [number, number], event: D3ZoomEvent | undefined) => void; /** Callback function to be called when the graph layout is calculated. Default: `undefined` */ onLayoutCalculated?: (nodes: SankeyNode[], links: SankeyLink[], depth: number, width: number, height: number, bleed: Spacing) => void; /** Set selected nodes by unique id. Default: `undefined` */ selectedNodeIds?: string[]; } export declare const SankeyDefaultConfig: SankeyConfigInterface;