@unovis/ts 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/annotations/config.d.ts +2 -0
- package/components/annotations/config.js +1 -1
- package/components/annotations/config.js.map +1 -1
- package/components/annotations/index.d.ts +1 -0
- package/components/annotations/index.js +25 -10
- package/components/annotations/index.js.map +1 -1
- package/components/annotations/style.d.ts +2 -0
- package/components/annotations/style.js +8 -1
- package/components/annotations/style.js.map +1 -1
- package/components/area/config.d.ts +11 -1
- package/components/area/config.js +1 -1
- package/components/area/config.js.map +1 -1
- package/components/area/index.d.ts +6 -0
- package/components/area/index.js +80 -7
- package/components/area/index.js.map +1 -1
- package/components/area/style.d.ts +1 -0
- package/components/area/style.js +7 -1
- package/components/area/style.js.map +1 -1
- package/components/axis/index.d.ts +2 -0
- package/components/axis/index.js +46 -7
- package/components/axis/index.js.map +1 -1
- package/components/bullet-legend/index.d.ts +2 -0
- package/components/bullet-legend/index.js +9 -5
- package/components/bullet-legend/index.js.map +1 -1
- package/components/bullet-legend/modules/shape.js +3 -2
- package/components/bullet-legend/modules/shape.js.map +1 -1
- package/components/crosshair/config.d.ts +1 -1
- package/components/crosshair/config.js.map +1 -1
- package/components/crosshair/index.d.ts +1 -1
- package/components/crosshair/index.js +3 -2
- package/components/crosshair/index.js.map +1 -1
- package/components/flow-legend/config.d.ts +10 -0
- package/components/flow-legend/config.js +4 -0
- package/components/flow-legend/config.js.map +1 -1
- package/components/flow-legend/index.d.ts +6 -2
- package/components/flow-legend/index.js +34 -16
- package/components/flow-legend/index.js.map +1 -1
- package/components/flow-legend/style.d.ts +3 -3
- package/components/flow-legend/style.js +30 -26
- package/components/flow-legend/style.js.map +1 -1
- package/components/free-brush/types.js +1 -0
- package/components/free-brush/types.js.map +1 -1
- package/components/graph/index.d.ts +1 -0
- package/components/graph/index.js +35 -14
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/link/index.js +2 -2
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/graph/modules/node/index.js +2 -1
- package/components/graph/modules/node/index.js.map +1 -1
- package/components/leaflet-map/leaflet.css.js +2 -2
- package/components/leaflet-map/modules/map.js +2 -2
- package/components/leaflet-map/modules/map.js.map +1 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.js +1 -2
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -1
- package/components/sankey/config.d.ts +28 -2
- package/components/sankey/config.js +2 -2
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +28 -2
- package/components/sankey/index.js +366 -46
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/label.d.ts +8 -5
- package/components/sankey/modules/label.js +64 -32
- package/components/sankey/modules/label.js.map +1 -1
- package/components/sankey/modules/link.d.ts +1 -0
- package/components/sankey/modules/link.js +20 -25
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/modules/node.d.ts +5 -4
- package/components/sankey/modules/node.js +78 -28
- package/components/sankey/modules/node.js.map +1 -1
- package/components/sankey/style.d.ts +67 -1
- package/components/sankey/style.js +78 -77
- package/components/sankey/style.js.map +1 -1
- package/components/sankey/types.d.ts +5 -0
- package/components/sankey/types.js +9 -2
- package/components/sankey/types.js.map +1 -1
- package/components/stacked-bar/index.d.ts +1 -1
- package/components/stacked-bar/index.js +24 -14
- package/components/stacked-bar/index.js.map +1 -1
- package/components/stacked-bar/types.d.ts +6 -4
- package/components/treemap/config.d.ts +2 -0
- package/components/treemap/config.js +1 -1
- package/components/treemap/config.js.map +1 -1
- package/components/treemap/index.d.ts +6 -2
- package/components/treemap/index.js +97 -71
- package/components/treemap/index.js.map +1 -1
- package/components/treemap/style.d.ts +1 -0
- package/components/treemap/style.js +5 -1
- package/components/treemap/style.js.map +1 -1
- package/components/treemap/types.d.ts +1 -0
- package/containers/single-container/config.d.ts +3 -0
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.js +2 -1
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +3 -0
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +1 -0
- package/containers/xy-container/index.js +13 -9
- package/containers/xy-container/index.js.map +1 -1
- package/index.js +1 -1
- package/package.json +41 -6
- package/types.js +1 -1
- package/utils/misc.js +13 -2
- package/utils/misc.js.map +1 -1
- package/utils/text.d.ts +1 -1
- package/utils/text.js +17 -15
- package/utils/text.js.map +1 -1
- package/utils/to-px.d.ts +1 -0
- package/utils/to-px.js +110 -0
- package/utils/to-px.js.map +1 -0
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
import { D3ZoomEvent } from 'd3-zoom';
|
|
1
2
|
import { ComponentConfigInterface } from "../../core/component/config";
|
|
2
3
|
import { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
3
4
|
import { TrimMode, VerticalAlign, FitMode } from "../../types/text";
|
|
4
5
|
import { Position } from "../../types/position";
|
|
5
|
-
import {
|
|
6
|
+
import { Spacing } from "../../types/spacing";
|
|
7
|
+
import { SankeyInputLink, SankeyInputNode, SankeyNodeAlign, SankeySubLabelPlacement, SankeyExitTransitionType, SankeyEnterTransitionType, SankeyLink, SankeyNode, SankeyZoomMode } from './types';
|
|
6
8
|
export interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {
|
|
7
9
|
/** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */
|
|
8
10
|
id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string;
|
|
9
11
|
/** 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` */
|
|
10
12
|
heightNormalizationCoeff?: number;
|
|
13
|
+
/** Horizontal and vertical scale factor applied to the computed layout (column spacing). Keeps node width intact. Default: `undefined` */
|
|
14
|
+
zoomScale?: [number, number];
|
|
15
|
+
/** Pan offset in pixels. Default: `undefined` */
|
|
16
|
+
zoomPan?: [number, number];
|
|
17
|
+
/** Enable interactive zoom/pan behavior. Default: `true` */
|
|
18
|
+
enableZoom?: boolean;
|
|
19
|
+
/** Allowed interactive zoom scale extent. Default: `[1, 5]` */
|
|
20
|
+
zoomExtent?: [number, number];
|
|
21
|
+
/** Zoom interaction mode. Default: `SankeyZoomMode.XY` */
|
|
22
|
+
zoomMode?: SankeyZoomMode | string;
|
|
11
23
|
/** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */
|
|
12
24
|
exitTransitionType?: SankeyExitTransitionType;
|
|
13
25
|
/** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */
|
|
@@ -77,10 +89,14 @@ export interface SankeyConfigInterface<N extends SankeyInputNode, L extends Sank
|
|
|
77
89
|
labelVerticalAlign?: VerticalAlign | string;
|
|
78
90
|
/** Label background */
|
|
79
91
|
labelBackground?: boolean;
|
|
80
|
-
/** Label fit mode (wrap or trim). Default: `FitMode.
|
|
92
|
+
/** Label fit mode (wrap or trim). Default: `FitMode.Trim` **/
|
|
81
93
|
labelFit?: FitMode;
|
|
82
94
|
/** Maximum label with in pixels. Default: `70` */
|
|
83
95
|
labelMaxWidth?: number;
|
|
96
|
+
/** Whether to take the available space for the label. This property is used only if `labelMaxWidth` is not provided. Default: `false` */
|
|
97
|
+
labelMaxWidthTakeAvailableSpace?: boolean;
|
|
98
|
+
/** 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) */
|
|
99
|
+
labelMaxWidthTakeAvailableSpaceTolerance?: number;
|
|
84
100
|
/** Expand trimmed label on hover. Default: `true` */
|
|
85
101
|
labelExpandTrimmedOnHover?: boolean;
|
|
86
102
|
/** Label trimming mode. Default: `TrimMode.Middle` */
|
|
@@ -89,6 +105,8 @@ export interface SankeyConfigInterface<N extends SankeyInputNode, L extends Sank
|
|
|
89
105
|
labelFontSize?: number;
|
|
90
106
|
/** Label text separators for wrapping. Default: `[' ', '-']` */
|
|
91
107
|
labelTextSeparator?: string[];
|
|
108
|
+
/** Label text decoration. Default: `undefined` */
|
|
109
|
+
labelTextDecoration?: StringAccessor<SankeyNode<N, L>>;
|
|
92
110
|
/** Force break words to fit long labels. Default: `true` */
|
|
93
111
|
labelForceWordBreak?: boolean;
|
|
94
112
|
/** Label color. Default: `undefined` */
|
|
@@ -108,10 +126,18 @@ export interface SankeyConfigInterface<N extends SankeyInputNode, L extends Sank
|
|
|
108
126
|
subLabelColor?: ColorAccessor<SankeyNode<N, L>>;
|
|
109
127
|
/** Sub-label position. Default: `SankeySubLabelPlacement.Below` */
|
|
110
128
|
subLabelPlacement?: SankeySubLabelPlacement | string;
|
|
129
|
+
/** Sub-label text decoration. Default: `undefined` */
|
|
130
|
+
subLabelTextDecoration?: StringAccessor<SankeyNode<N, L>>;
|
|
111
131
|
/**
|
|
112
132
|
* Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`
|
|
113
133
|
* Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.
|
|
114
134
|
*/
|
|
115
135
|
subLabelToLabelInlineWidthRatio?: number;
|
|
136
|
+
/** Zoom event callback. Default: `undefined` */
|
|
137
|
+
onZoom?: (horizontalScale: number, verticalScale: number, panX: number, panY: number, zoomExtent: [number, number], event: D3ZoomEvent<SVGGElement, unknown> | undefined) => void;
|
|
138
|
+
/** Callback function to be called when the graph layout is calculated. Default: `undefined` */
|
|
139
|
+
onLayoutCalculated?: (nodes: SankeyNode<N, L>[], links: SankeyLink<N, L>[], depth: number, width: number, height: number, bleed: Spacing) => void;
|
|
140
|
+
/** Set selected nodes by unique id. Default: `undefined` */
|
|
141
|
+
selectedNodeIds?: string[];
|
|
116
142
|
}
|
|
117
143
|
export declare const SankeyDefaultConfig: SankeyConfigInterface<SankeyInputNode, SankeyInputLink>;
|
|
@@ -2,10 +2,10 @@ import { ComponentDefaultConfig } from '../../core/component/config.js';
|
|
|
2
2
|
import { getNumber } from '../../utils/data.js';
|
|
3
3
|
import { VerticalAlign, FitMode, TrimMode } from '../../types/text.js';
|
|
4
4
|
import { Position } from '../../types/position.js';
|
|
5
|
-
import { SankeyExitTransitionType, SankeyEnterTransitionType, SankeyNodeAlign, SankeySubLabelPlacement } from './types.js';
|
|
5
|
+
import { SankeyZoomMode, SankeyExitTransitionType, SankeyEnterTransitionType, SankeyNodeAlign, SankeySubLabelPlacement } from './types.js';
|
|
6
6
|
|
|
7
7
|
// Config
|
|
8
|
-
const SankeyDefaultConfig = (Object.assign(Object.assign({}, ComponentDefaultConfig), { heightNormalizationCoeff: 1 / 16, exitTransitionType: SankeyExitTransitionType.Default, enterTransitionType: SankeyEnterTransitionType.Default, id: (d, i) => { var _a; return (_a = d._id) !== null && _a !== void 0 ? _a : `${i}`; }, highlightSubtreeOnHover: false, highlightDuration: 300, highlightDelay: 1000, iterations: 32, nodeSort: undefined, nodeWidth: 25, nodeAlign: SankeyNodeAlign.Justify, nodeHorizontalSpacing: 150, nodeMinHeight: 20, nodeMaxHeight: 100, nodePadding: 2, nodeColor: (d) => d.color, nodeFixedValue: (d) => d.fixedValue, showSingleNode: true, nodeCursor: undefined, nodeIcon: undefined, nodeIconColor: undefined, label: (d) => d.label, labelPosition: Position.Auto, labelVerticalAlign: VerticalAlign.Middle, labelBackground: false, labelTextSeparator: [' ', '-'], labelFit: FitMode.Trim, labelTrimMode: TrimMode.Middle, labelForceWordBreak: true, labelFontSize: undefined, labelCursor: undefined, labelColor: undefined, labelMaxWidth:
|
|
8
|
+
const SankeyDefaultConfig = (Object.assign(Object.assign({}, ComponentDefaultConfig), { heightNormalizationCoeff: 1 / 16, zoomScale: undefined, zoomPan: undefined, enableZoom: false, zoomExtent: [1, 5], zoomMode: SankeyZoomMode.Y, exitTransitionType: SankeyExitTransitionType.Default, enterTransitionType: SankeyEnterTransitionType.Default, id: (d, i) => { var _a; return (_a = d._id) !== null && _a !== void 0 ? _a : `${i}`; }, highlightSubtreeOnHover: false, highlightDuration: 300, highlightDelay: 1000, iterations: 32, nodeSort: undefined, nodeWidth: 25, nodeAlign: SankeyNodeAlign.Justify, nodeHorizontalSpacing: 150, nodeMinHeight: 20, nodeMaxHeight: 100, nodePadding: 2, nodeColor: (d) => d.color, nodeFixedValue: (d) => d.fixedValue, showSingleNode: true, nodeCursor: undefined, nodeIcon: undefined, nodeIconColor: undefined, label: (d) => d.label, labelPosition: Position.Auto, labelVerticalAlign: VerticalAlign.Middle, labelBackground: false, labelTextSeparator: [' ', '-'], labelTextDecoration: undefined, labelFit: FitMode.Trim, labelTrimMode: TrimMode.Middle, labelForceWordBreak: true, labelFontSize: undefined, labelCursor: undefined, labelColor: undefined, labelMaxWidth: undefined, labelMaxWidthTakeAvailableSpace: false, labelMaxWidthTakeAvailableSpaceTolerance: undefined, labelExpandTrimmedOnHover: true, labelVisibility: undefined, subLabel: undefined, subLabelFontSize: undefined, subLabelColor: undefined, subLabelPlacement: SankeySubLabelPlacement.Below, subLabelToLabelInlineWidthRatio: 0.4, subLabelTextDecoration: undefined, linkValue: (d) => d.value, linkColor: (d) => d.color, linkCursor: undefined, onZoom: undefined, onLayoutCalculated: undefined, selectedNodeIds: undefined,
|
|
9
9
|
// https://stackoverflow.com/a/21648197/2040291
|
|
10
10
|
init: function () {
|
|
11
11
|
this.linkSort =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/sankey/config.ts"],"sourcesContent":["// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Utils\nimport { getNumber } from 'utils/data'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TrimMode, VerticalAlign, FitMode } from 'types/text'\nimport { Position } from 'types/position'\nimport {\n SankeyInputLink,\n SankeyInputNode,\n SankeyNodeAlign,\n SankeySubLabelPlacement,\n SankeyExitTransitionType,\n SankeyEnterTransitionType,\n SankeyLink,\n SankeyNode,\n} from './types'\n\nexport interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {\n // General\n /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */\n id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string;\n /** 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` */\n heightNormalizationCoeff?: number;\n /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */\n exitTransitionType?: SankeyExitTransitionType;\n /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */\n enterTransitionType?: SankeyEnterTransitionType;\n /** Highlight the corresponding subtree on node / link hover. Default: `false` */\n highlightSubtreeOnHover?: boolean;\n /** Highlight animation duration, ms. Default: `400` */\n highlightDuration?: number;\n /** Highlight delay, ms. Default: `1000` */\n highlightDelay?: number;\n /** Sankey algorithm iterations. Default: `32` */\n iterations?: number;\n\n // Sorting\n /** Sankey node sorting function. Default: `undefined`.\n * Node sorting is applied to nodes in one layer (column). Layer by layer.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n nodeSort?: ((node1: SankeyNode<N, L>, node2: SankeyNode<N, L>) => number) | null | undefined;\n /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.\n * Link sorting is applied to the source (exiting) links within one node.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n linkSort?: ((link1: SankeyLink<N, L>, link2: SankeyLink<N, L>) => number) | null | undefined;\n\n // Nodes\n /** Sankey node width in pixels */\n nodeWidth?: number;\n /** Sankey node alignment method */\n nodeAlign?: SankeyNodeAlign;\n /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */\n nodeHorizontalSpacing?: number;\n /** Minimum node height. Extended Sizing property only. Default: `20` */\n nodeMinHeight?: number;\n /** Maximum node height. Extended Sizing property only. Default: `100` */\n nodeMaxHeight?: number;\n /** Sankey vertical separation between nodes in pixels. Default: `2` */\n nodePadding?: number;\n /** Display the graph when data has just one element */\n showSingleNode?: boolean;\n /** Node cursor on hover. Default: `undefined` */\n nodeCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Node icon accessor function or value. Default: `undefined` */\n nodeIcon?: StringAccessor<SankeyNode<N, L>>;\n /** Node color accessor function or value. Default: `undefined` */\n nodeColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate\n * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).\n * Default: `n => n.fixedValue`\n */\n nodeFixedValue?: NumericAccessor<N>;\n /** Icon color accessor function or value. Default: `undefined` */\n nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;\n\n // Links\n /** Link color accessor function or value. Default: `l => l.color` */\n linkColor?: StringAccessor<SankeyLink<N, L>>;\n /** Link flow accessor function or value. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Link cursor on hover. Default: `undefined` */\n linkCursor?: StringAccessor<SankeyLink<N, L>>;\n\n // Labels\n /** Node label accessor function or value. Default: `n => n.label` */\n label?: StringAccessor<SankeyNode<N, L>>;\n /** Node sub-label accessor function or value. Default: `undefined` */\n subLabel?: StringAccessor<SankeyNode<N, L>>;\n /** Label position relative to the Node. Default: `Position.AUTO` */\n labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;\n /** Label vertical alignment */\n labelVerticalAlign?: VerticalAlign | string;\n /** Label background */\n labelBackground?: boolean;\n /** Label fit mode (wrap or trim). Default: `FitMode.TRIM` **/\n labelFit?: FitMode;\n /** Maximum label with in pixels. Default: `70` */\n labelMaxWidth?: number;\n /** Expand trimmed label on hover. Default: `true` */\n labelExpandTrimmedOnHover?: boolean;\n /** Label trimming mode. Default: `TrimMode.Middle` */\n labelTrimMode?: TrimMode;\n /** Label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-label-font-size` will be used. Default: `undefined` */\n labelFontSize?: number;\n /** Label text separators for wrapping. Default: `[' ', '-']` */\n labelTextSeparator?: string[];\n /** Force break words to fit long labels. Default: `true` */\n labelForceWordBreak?: boolean;\n /** Label color. Default: `undefined` */\n labelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Label cursor on hover. Default: `undefined` */\n labelCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Custom function to set the label visibility. Default: `undefined` */\n labelVisibility?: ((d: SankeyNode<N, L>, bbox: { x: number; y: number; width: number; height: number }, hovered: boolean) => boolean) | undefined;\n /** 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` */\n subLabelFontSize?: number;\n /** Sub-label color. Default: `undefined` */\n subLabelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */\n subLabelPlacement?: SankeySubLabelPlacement | string;\n /**\n * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`\n * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.\n */\n subLabelToLabelInlineWidthRatio?: number;\n}\n\nexport const SankeyDefaultConfig: SankeyConfigInterface<SankeyInputNode, SankeyInputLink> = ({\n ...ComponentDefaultConfig,\n heightNormalizationCoeff: 1 / 16,\n exitTransitionType: SankeyExitTransitionType.Default,\n enterTransitionType: SankeyEnterTransitionType.Default,\n id: (d: SankeyInputNode, i: number) => (d as { _id: string })._id ?? `${i}`,\n highlightSubtreeOnHover: false,\n highlightDuration: 300,\n highlightDelay: 1000,\n iterations: 32,\n nodeSort: undefined,\n nodeWidth: 25,\n nodeAlign: SankeyNodeAlign.Justify,\n nodeHorizontalSpacing: 150,\n nodeMinHeight: 20,\n nodeMaxHeight: 100,\n nodePadding: 2,\n nodeColor: (d: SankeyInputNode) => (d as { color: string }).color,\n nodeFixedValue: (d: SankeyInputNode) => (d as { fixedValue: number }).fixedValue,\n showSingleNode: true,\n nodeCursor: undefined,\n nodeIcon: undefined,\n nodeIconColor: undefined,\n label: (d: SankeyInputNode) => (d as { label: string }).label,\n labelPosition: Position.Auto,\n labelVerticalAlign: VerticalAlign.Middle,\n labelBackground: false,\n labelTextSeparator: [' ', '-'],\n labelFit: FitMode.Trim,\n labelTrimMode: TrimMode.Middle,\n labelForceWordBreak: true,\n labelFontSize: undefined,\n labelCursor: undefined,\n labelColor: undefined,\n labelMaxWidth: 70,\n labelExpandTrimmedOnHover: true,\n labelVisibility: undefined,\n subLabel: undefined,\n subLabelFontSize: undefined,\n subLabelColor: undefined,\n subLabelPlacement: SankeySubLabelPlacement.Below,\n subLabelToLabelInlineWidthRatio: 0.4,\n linkValue: (d: SankeyInputNode) => (d as { value: number }).value,\n linkColor: (d: SankeyInputNode) => (d as { color: string }).color,\n linkCursor: undefined,\n\n // https://stackoverflow.com/a/21648197/2040291\n init: function () {\n (this as SankeyConfigInterface<SankeyInputNode, SankeyInputLink>).linkSort =\n (link2, link1) => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue)\n delete this.init\n return this\n },\n}).init()\n\n"],"names":[],"mappings":";;;;;;AAAA;AAyIa,MAAA,mBAAmB,GAA4D,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACvF,sBAAsB,CAAA,EAAA,EACzB,wBAAwB,EAAE,CAAC,GAAG,EAAE,EAChC,kBAAkB,EAAE,wBAAwB,CAAC,OAAO,EACpD,mBAAmB,EAAE,yBAAyB,CAAC,OAAO,EACtD,EAAE,EAAE,CAAC,CAAkB,EAAE,CAAS,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAC,EAAA,GAAA,CAAqB,CAAC,GAAG,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,CAAC,CAAA,CAAE,CAAA,EAAA,EAC3E,uBAAuB,EAAE,KAAK,EAC9B,iBAAiB,EAAE,GAAG,EACtB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,EAAE,EACb,SAAS,EAAE,eAAe,CAAC,OAAO,EAClC,qBAAqB,EAAE,GAAG,EAC1B,aAAa,EAAE,EAAE,EACjB,aAAa,EAAE,GAAG,EAClB,WAAW,EAAE,CAAC,EACd,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,cAAc,EAAE,CAAC,CAAkB,KAAM,CAA4B,CAAC,UAAU,EAChF,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,aAAa,EAAE,SAAS,EACxB,KAAK,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EAC7D,aAAa,EAAE,QAAQ,CAAC,IAAI,EAC5B,kBAAkB,EAAE,aAAa,CAAC,MAAM,EACxC,eAAe,EAAE,KAAK,EACtB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9B,QAAQ,EAAE,OAAO,CAAC,IAAI,EACtB,aAAa,EAAE,QAAQ,CAAC,MAAM,EAC9B,mBAAmB,EAAE,IAAI,EACzB,aAAa,EAAE,SAAS,EACxB,WAAW,EAAE,SAAS,EACtB,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,EAAE,EACjB,yBAAyB,EAAE,IAAI,EAC/B,eAAe,EAAE,SAAS,EAC1B,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,uBAAuB,CAAC,KAAK,EAChD,+BAA+B,EAAE,GAAG,EACpC,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,UAAU,EAAE,SAAS;;AAGrB,IAAA,IAAI,EAAE,YAAA;AACH,QAAA,IAAgE,CAAC,QAAQ;YACxE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACvF,OAAO,IAAI,CAAC,IAAI,CAAA;AAChB,QAAA,OAAO,IAAI,CAAA;AACb,KAAC,EACD,CAAA,EAAC,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/sankey/config.ts"],"sourcesContent":["import { D3ZoomEvent } from 'd3-zoom'\n\n// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Utils\nimport { getNumber } from 'utils/data'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TrimMode, VerticalAlign, FitMode } from 'types/text'\nimport { Position } from 'types/position'\nimport { Spacing } from 'types/spacing'\n\nimport {\n SankeyInputLink,\n SankeyInputNode,\n SankeyNodeAlign,\n SankeySubLabelPlacement,\n SankeyExitTransitionType,\n SankeyEnterTransitionType,\n SankeyLink,\n SankeyNode,\n SankeyZoomMode,\n} from './types'\n\nexport interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {\n // General\n /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */\n id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string;\n /** 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` */\n heightNormalizationCoeff?: number;\n /** Horizontal and vertical scale factor applied to the computed layout (column spacing). Keeps node width intact. Default: `undefined` */\n zoomScale?: [number, number];\n /** Pan offset in pixels. Default: `undefined` */\n zoomPan?: [number, number];\n /** Enable interactive zoom/pan behavior. Default: `true` */\n enableZoom?: boolean;\n /** Allowed interactive zoom scale extent. Default: `[1, 5]` */\n zoomExtent?: [number, number];\n /** Zoom interaction mode. Default: `SankeyZoomMode.XY` */\n zoomMode?: SankeyZoomMode | string;\n /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */\n exitTransitionType?: SankeyExitTransitionType;\n /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */\n enterTransitionType?: SankeyEnterTransitionType;\n /** Highlight the corresponding subtree on node / link hover. Default: `false` */\n highlightSubtreeOnHover?: boolean;\n /** Highlight animation duration, ms. Default: `400` */\n highlightDuration?: number;\n /** Highlight delay, ms. Default: `1000` */\n highlightDelay?: number;\n /** Sankey algorithm iterations. Default: `32` */\n iterations?: number;\n\n // Sorting\n /** Sankey node sorting function. Default: `undefined`.\n * Node sorting is applied to nodes in one layer (column). Layer by layer.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n nodeSort?: ((node1: SankeyNode<N, L>, node2: SankeyNode<N, L>) => number) | null | undefined;\n /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.\n * Link sorting is applied to the source (exiting) links within one node.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n linkSort?: ((link1: SankeyLink<N, L>, link2: SankeyLink<N, L>) => number) | null | undefined;\n\n // Nodes\n /** Sankey node width in pixels */\n nodeWidth?: number;\n /** Sankey node alignment method */\n nodeAlign?: SankeyNodeAlign;\n /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */\n nodeHorizontalSpacing?: number;\n /** Minimum node height. Extended Sizing property only. Default: `20` */\n nodeMinHeight?: number;\n /** Maximum node height. Extended Sizing property only. Default: `100` */\n nodeMaxHeight?: number;\n /** Sankey vertical separation between nodes in pixels. Default: `2` */\n nodePadding?: number;\n /** Display the graph when data has just one element */\n showSingleNode?: boolean;\n /** Node cursor on hover. Default: `undefined` */\n nodeCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Node icon accessor function or value. Default: `undefined` */\n nodeIcon?: StringAccessor<SankeyNode<N, L>>;\n /** Node color accessor function or value. Default: `undefined` */\n nodeColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate\n * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).\n * Default: `n => n.fixedValue`\n */\n nodeFixedValue?: NumericAccessor<N>;\n /** Icon color accessor function or value. Default: `undefined` */\n nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;\n\n // Links\n /** Link color accessor function or value. Default: `l => l.color` */\n linkColor?: StringAccessor<SankeyLink<N, L>>;\n /** Link flow accessor function or value. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Link cursor on hover. Default: `undefined` */\n linkCursor?: StringAccessor<SankeyLink<N, L>>;\n\n // Labels\n /** Node label accessor function or value. Default: `n => n.label` */\n label?: StringAccessor<SankeyNode<N, L>>;\n /** Node sub-label accessor function or value. Default: `undefined` */\n subLabel?: StringAccessor<SankeyNode<N, L>>;\n /** Label position relative to the Node. Default: `Position.AUTO` */\n labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;\n /** Label vertical alignment */\n labelVerticalAlign?: VerticalAlign | string;\n /** Label background */\n labelBackground?: boolean;\n /** Label fit mode (wrap or trim). Default: `FitMode.Trim` **/\n labelFit?: FitMode;\n /** Maximum label with in pixels. Default: `70` */\n labelMaxWidth?: number;\n /** Whether to take the available space for the label. This property is used only if `labelMaxWidth` is not provided. Default: `false` */\n labelMaxWidthTakeAvailableSpace?: boolean;\n /** 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) */\n labelMaxWidthTakeAvailableSpaceTolerance?: number;\n /** Expand trimmed label on hover. Default: `true` */\n labelExpandTrimmedOnHover?: boolean;\n /** Label trimming mode. Default: `TrimMode.Middle` */\n labelTrimMode?: TrimMode;\n /** Label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-label-font-size` will be used. Default: `undefined` */\n labelFontSize?: number;\n /** Label text separators for wrapping. Default: `[' ', '-']` */\n labelTextSeparator?: string[];\n /** Label text decoration. Default: `undefined` */\n labelTextDecoration?: StringAccessor<SankeyNode<N, L>>;\n /** Force break words to fit long labels. Default: `true` */\n labelForceWordBreak?: boolean;\n /** Label color. Default: `undefined` */\n labelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Label cursor on hover. Default: `undefined` */\n labelCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Custom function to set the label visibility. Default: `undefined` */\n labelVisibility?: ((d: SankeyNode<N, L>, bbox: { x: number; y: number; width: number; height: number }, hovered: boolean) => boolean) | undefined;\n /** 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` */\n subLabelFontSize?: number;\n /** Sub-label color. Default: `undefined` */\n subLabelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */\n subLabelPlacement?: SankeySubLabelPlacement | string;\n /** Sub-label text decoration. Default: `undefined` */\n subLabelTextDecoration?: StringAccessor<SankeyNode<N, L>>;\n /**\n * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`\n * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.\n */\n subLabelToLabelInlineWidthRatio?: number;\n\n // Events\n /** Zoom event callback. Default: `undefined` */\n onZoom?: (horizontalScale: number, verticalScale: number, panX: number, panY: number, zoomExtent: [number, number], event: D3ZoomEvent<SVGGElement, unknown> | undefined) => void;\n /** Callback function to be called when the graph layout is calculated. Default: `undefined` */\n onLayoutCalculated?: (nodes: SankeyNode<N, L>[], links: SankeyLink<N, L>[], depth: number, width: number, height: number, bleed: Spacing) => void;\n\n // Misc\n /** Set selected nodes by unique id. Default: `undefined` */\n selectedNodeIds?: string[];\n}\n\nexport const SankeyDefaultConfig: SankeyConfigInterface<SankeyInputNode, SankeyInputLink> = ({\n ...ComponentDefaultConfig,\n heightNormalizationCoeff: 1 / 16,\n zoomScale: undefined,\n zoomPan: undefined,\n enableZoom: false,\n zoomExtent: [1, 5] as [number, number],\n zoomMode: SankeyZoomMode.Y,\n exitTransitionType: SankeyExitTransitionType.Default,\n enterTransitionType: SankeyEnterTransitionType.Default,\n id: (d: SankeyInputNode, i: number) => (d as { _id: string })._id ?? `${i}`,\n highlightSubtreeOnHover: false,\n highlightDuration: 300,\n highlightDelay: 1000,\n iterations: 32,\n nodeSort: undefined,\n nodeWidth: 25,\n nodeAlign: SankeyNodeAlign.Justify,\n nodeHorizontalSpacing: 150,\n nodeMinHeight: 20,\n nodeMaxHeight: 100,\n nodePadding: 2,\n nodeColor: (d: SankeyInputNode) => (d as { color: string }).color,\n nodeFixedValue: (d: SankeyInputNode) => (d as { fixedValue: number }).fixedValue,\n showSingleNode: true,\n nodeCursor: undefined,\n nodeIcon: undefined,\n nodeIconColor: undefined,\n label: (d: SankeyInputNode) => (d as { label: string }).label,\n labelPosition: Position.Auto,\n labelVerticalAlign: VerticalAlign.Middle,\n labelBackground: false,\n labelTextSeparator: [' ', '-'],\n labelTextDecoration: undefined,\n labelFit: FitMode.Trim,\n labelTrimMode: TrimMode.Middle,\n labelForceWordBreak: true,\n labelFontSize: undefined,\n labelCursor: undefined,\n labelColor: undefined,\n labelMaxWidth: undefined,\n labelMaxWidthTakeAvailableSpace: false,\n labelMaxWidthTakeAvailableSpaceTolerance: undefined,\n labelExpandTrimmedOnHover: true,\n labelVisibility: undefined,\n subLabel: undefined,\n subLabelFontSize: undefined,\n subLabelColor: undefined,\n subLabelPlacement: SankeySubLabelPlacement.Below,\n subLabelToLabelInlineWidthRatio: 0.4,\n subLabelTextDecoration: undefined,\n linkValue: (d: SankeyInputNode) => (d as { value: number }).value,\n linkColor: (d: SankeyInputNode) => (d as { color: string }).color,\n linkCursor: undefined,\n onZoom: undefined,\n onLayoutCalculated: undefined,\n selectedNodeIds: undefined,\n\n // https://stackoverflow.com/a/21648197/2040291\n init: function () {\n (this as SankeyConfigInterface<SankeyInputNode, SankeyInputLink>).linkSort =\n (link2, link1) => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue)\n delete this.init\n return this\n },\n}).init()\n\n"],"names":[],"mappings":";;;;;;AAEA;AAwKO,MAAM,mBAAmB,GAA4D,iCACvF,sBAAsB,CAAA,EAAA,EACzB,wBAAwB,EAAE,CAAC,GAAG,EAAE,EAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,SAAS,EAClB,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAqB,EACtC,QAAQ,EAAE,cAAc,CAAC,CAAC,EAC1B,kBAAkB,EAAE,wBAAwB,CAAC,OAAO,EACpD,mBAAmB,EAAE,yBAAyB,CAAC,OAAO,EACtD,EAAE,EAAE,CAAC,CAAkB,EAAE,CAAS,KAAI,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAC,CAAqB,CAAC,GAAG,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,CAAC,CAAE,CAAA,CAAA,EAAA,EAC3E,uBAAuB,EAAE,KAAK,EAC9B,iBAAiB,EAAE,GAAG,EACtB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,EAAE,EACb,SAAS,EAAE,eAAe,CAAC,OAAO,EAClC,qBAAqB,EAAE,GAAG,EAC1B,aAAa,EAAE,EAAE,EACjB,aAAa,EAAE,GAAG,EAClB,WAAW,EAAE,CAAC,EACd,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,cAAc,EAAE,CAAC,CAAkB,KAAM,CAA4B,CAAC,UAAU,EAChF,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,aAAa,EAAE,SAAS,EACxB,KAAK,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EAC7D,aAAa,EAAE,QAAQ,CAAC,IAAI,EAC5B,kBAAkB,EAAE,aAAa,CAAC,MAAM,EACxC,eAAe,EAAE,KAAK,EACtB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9B,mBAAmB,EAAE,SAAS,EAC9B,QAAQ,EAAE,OAAO,CAAC,IAAI,EACtB,aAAa,EAAE,QAAQ,CAAC,MAAM,EAC9B,mBAAmB,EAAE,IAAI,EACzB,aAAa,EAAE,SAAS,EACxB,WAAW,EAAE,SAAS,EACtB,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,SAAS,EACxB,+BAA+B,EAAE,KAAK,EACtC,wCAAwC,EAAE,SAAS,EACnD,yBAAyB,EAAE,IAAI,EAC/B,eAAe,EAAE,SAAS,EAC1B,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,uBAAuB,CAAC,KAAK,EAChD,+BAA+B,EAAE,GAAG,EACpC,sBAAsB,EAAE,SAAS,EACjC,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,UAAU,EAAE,SAAS,EACrB,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAAE,SAAS,EAC7B,eAAe,EAAE,SAAS;;AAG1B,IAAA,IAAI,EAAE,YAAA;AACH,QAAA,IAAgE,CAAC,QAAQ;YACxE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACvF,OAAO,IAAI,CAAC,IAAI,CAAA;AAChB,QAAA,OAAO,IAAI,CAAA;AACb,KAAC,EACD,CAAA,EAAC,IAAI;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Selection } from 'd3-selection';
|
|
1
2
|
import { ComponentCore } from "../../core/component";
|
|
2
3
|
import { GraphDataModel } from "../../data-models/graph";
|
|
3
4
|
import { ExtendedSizeComponent } from "../../types/component";
|
|
@@ -13,22 +14,32 @@ export declare class Sankey<N extends SankeyInputNode, L extends SankeyInputLink
|
|
|
13
14
|
protected _defaultConfig: SankeyConfigInterface<N, L>;
|
|
14
15
|
config: SankeyConfigInterface<N, L>;
|
|
15
16
|
datamodel: GraphDataModel<N, L, SankeyNode<N, L>, SankeyLink<N, L>>;
|
|
17
|
+
g: Selection<SVGGElement, unknown, null, undefined>;
|
|
18
|
+
private _gNode;
|
|
19
|
+
private _prevWidth;
|
|
16
20
|
private _extendedWidth;
|
|
17
21
|
private _extendedHeight;
|
|
18
22
|
private _extendedHeightIncreased;
|
|
23
|
+
private _extendedWidthIncreased;
|
|
19
24
|
private _linksGroup;
|
|
20
25
|
private _nodesGroup;
|
|
21
26
|
private _backgroundRect;
|
|
22
27
|
private _sankey;
|
|
23
28
|
private _highlightTimeoutId;
|
|
24
29
|
private _highlightActive;
|
|
30
|
+
private _zoomScale;
|
|
31
|
+
private _pan;
|
|
32
|
+
private _zoomBehavior;
|
|
33
|
+
private _prevZoomTransform;
|
|
34
|
+
private _animationFrameId;
|
|
35
|
+
private _bleedCached;
|
|
25
36
|
events: {
|
|
26
37
|
[x: string]: {
|
|
27
38
|
mouseenter: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
28
39
|
mouseleave: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
29
40
|
} | {
|
|
30
|
-
mouseenter: (d: SankeyLink<N, L
|
|
31
|
-
mouseleave: (
|
|
41
|
+
mouseenter: (d: SankeyLink<N, L>) => void;
|
|
42
|
+
mouseleave: () => void;
|
|
32
43
|
};
|
|
33
44
|
};
|
|
34
45
|
constructor(config?: SankeyConfigInterface<N, L>);
|
|
@@ -39,18 +50,33 @@ export declare class Sankey<N extends SankeyInputNode, L extends SankeyInputLink
|
|
|
39
50
|
}): void;
|
|
40
51
|
setConfig(config: SankeyConfigInterface<N, L>): void;
|
|
41
52
|
_render(customDuration?: number): void;
|
|
53
|
+
private _applyPanTransform;
|
|
54
|
+
private _scheduleRender;
|
|
55
|
+
private _getConstrainedPan;
|
|
56
|
+
setZoomScale(horizontalScale?: number, verticalScale?: number, duration?: number): void;
|
|
57
|
+
getZoomScale(): [number, number];
|
|
58
|
+
setPan(x: number, y: number, duration?: number, shouldConstraint?: boolean): void;
|
|
59
|
+
getPan(): [number, number];
|
|
60
|
+
fitView(duration?: number): void;
|
|
61
|
+
private _onZoom;
|
|
42
62
|
private _populateLinkAndNodeValues;
|
|
43
63
|
private _preCalculateComponentSize;
|
|
44
64
|
private _prepareLayout;
|
|
65
|
+
private _applyLayoutScaling;
|
|
45
66
|
getWidth(): number;
|
|
46
67
|
getHeight(): number;
|
|
47
68
|
getLayoutWidth(): number;
|
|
48
69
|
getLayoutHeight(): number;
|
|
70
|
+
getSankeyDepth(): number;
|
|
71
|
+
/** @deprecated Use getLayerXCenters instead */
|
|
49
72
|
getColumnCenters(): number[];
|
|
73
|
+
getLayerXCenters(): number[];
|
|
74
|
+
getLayerYCenters(): number[];
|
|
50
75
|
highlightSubtree(node: SankeyNode<N, L>): void;
|
|
51
76
|
recursiveSetSubtreeState(node: SankeyNode<N, L>, linksKey: 'sourceLinks' | 'targetLinks', nodeKey: 'source' | 'target', key: string, value: unknown): void;
|
|
52
77
|
disableHighlight(): void;
|
|
53
78
|
private _hasLinks;
|
|
79
|
+
private _getLayerSpacing;
|
|
54
80
|
private _onNodeMouseOver;
|
|
55
81
|
private _onNodeMouseOut;
|
|
56
82
|
private _onNodeRectMouseOver;
|