@visactor/vchart 1.13.15 → 1.13.16
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/build/es5/index.js +1 -1
- package/build/index.es.js +68 -62
- package/build/index.js +132 -126
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/core/expression-function.js +1 -2
- package/cjs/core/index.d.ts +2 -1
- package/cjs/core/index.js +5 -4
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interface.js +2 -1
- package/cjs/series/dot/dot.d.ts +1 -1
- package/cjs/series/link/link.d.ts +1 -1
- package/cjs/series/sankey/interface.d.ts +2 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.d.ts +7 -6
- package/cjs/series/sankey/sankey.js +43 -46
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/util/style.js +3 -2
- package/cjs/util/style.js.map +1 -1
- package/esm/core/expression-function.js +1 -2
- package/esm/core/index.d.ts +2 -1
- package/esm/core/index.js +3 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/interface.js +2 -1
- package/esm/series/dot/dot.d.ts +1 -1
- package/esm/series/link/link.d.ts +1 -1
- package/esm/series/sankey/interface.d.ts +2 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.d.ts +7 -6
- package/esm/series/sankey/sankey.js +43 -40
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/util/style.js +3 -2
- package/esm/util/style.js.map +1 -1
- package/package.json +4 -4
package/cjs/core/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.13.
|
|
4
|
+
export declare const version = "1.13.16";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export type { IRegion } from '../region/interface';
|
|
8
8
|
export * from '../typings/spec/common';
|
|
9
9
|
export * from '../event/interface';
|
|
10
10
|
export * from '../theme/interface';
|
|
11
|
+
export * from '../compile/mark/interface';
|
|
11
12
|
export * from './interface';
|
|
12
13
|
export * from '../constant/base';
|
|
13
14
|
export * from '../constant/data';
|
package/cjs/core/index.js
CHANGED
|
@@ -35,11 +35,12 @@ Object.defineProperty(exports, "Factory", {
|
|
|
35
35
|
get: function() {
|
|
36
36
|
return factory_1.Factory;
|
|
37
37
|
}
|
|
38
|
-
}), exports.version = "1.13.
|
|
38
|
+
}), exports.version = "1.13.16", __exportStar(require("../typings/spec/common"), exports),
|
|
39
39
|
__exportStar(require("../event/interface"), exports), __exportStar(require("../theme/interface"), exports),
|
|
40
|
-
__exportStar(require("
|
|
41
|
-
__exportStar(require("../constant/
|
|
42
|
-
__exportStar(require("../typings/
|
|
40
|
+
__exportStar(require("../compile/mark/interface"), exports), __exportStar(require("./interface"), exports),
|
|
41
|
+
__exportStar(require("../constant/base"), exports), __exportStar(require("../constant/data"), exports),
|
|
42
|
+
__exportStar(require("../typings/spec/index"), exports), __exportStar(require("../typings/tooltip"), exports),
|
|
43
|
+
__exportStar(require("../theme/index"), exports);
|
|
43
44
|
|
|
44
45
|
var vrender_core_1 = require("@visactor/vrender-core");
|
|
45
46
|
|
package/cjs/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,SAAS,CAAC;AAOjC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAG5B,mDAAiC;AACjC,mDAAiC;AAKjC,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAYgC;AAX9B,uGAAA,OAAO,OAAA;AACP,2GAAA,WAAW,OAAA;AACX,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AACV,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA;AACZ,4GAAA,YAAY,OAAA;AACZ,2GAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,SAAS,CAAC;AAOjC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,4DAA0C;AAC1C,8CAA4B;AAG5B,mDAAiC;AACjC,mDAAiC;AAKjC,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAYgC;AAX9B,uGAAA,OAAO,OAAA;AACP,2GAAA,WAAW,OAAA;AACX,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AACV,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA;AACZ,4GAAA,YAAY,OAAA;AACZ,2GAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.16\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../compile/mark/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol,\n ManualTicker,\n StreamLight\n} from '@visactor/vrender-core';\n"]}
|
package/cjs/core/interface.js
CHANGED
package/cjs/series/dot/dot.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare class DotSeries<T extends IDotSeriesSpec = IDotSeriesSpec> extend
|
|
|
63
63
|
protected initTooltip(): void;
|
|
64
64
|
onEvaluateEnd(ctx: IModelEvaluateOption): void;
|
|
65
65
|
protected onMarkTreePositionUpdate(marks: IMark[]): void;
|
|
66
|
-
getDotData(): import("
|
|
66
|
+
getDotData(): import("../..").IMarkData;
|
|
67
67
|
protected _getDataIdKey(): any;
|
|
68
68
|
getStackValueField(): string;
|
|
69
69
|
getActiveMarks(): IMark[];
|
|
@@ -47,7 +47,7 @@ export declare class LinkSeries<T extends ILinkSeriesSpec = ILinkSeriesSpec> ext
|
|
|
47
47
|
initInteraction(): void;
|
|
48
48
|
protected initTooltip(): void;
|
|
49
49
|
protected onMarkTreePositionUpdate(marks: IMark[]): void;
|
|
50
|
-
getDotInfoData(): import("
|
|
50
|
+
getDotInfoData(): import("../..").IMarkData;
|
|
51
51
|
getActiveMarks(): IMark[];
|
|
52
52
|
}
|
|
53
53
|
export declare const registerLinkSeries: () => void;
|
|
@@ -48,6 +48,8 @@ export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimation
|
|
|
48
48
|
enable: boolean;
|
|
49
49
|
trigger?: 'click' | 'hover';
|
|
50
50
|
effect: 'self' | 'adjacency' | 'related';
|
|
51
|
+
highlightState?: string;
|
|
52
|
+
blurState?: string;
|
|
51
53
|
};
|
|
52
54
|
[SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];
|
|
53
55
|
overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n type: 'sankey';\n\n /**\n * 数据字段配置\n */\n /** 节点名称字段配置 */\n categoryField: string;\n /** 节点之间关系的权重字段 */\n valueField: string;\n /** 来源节点数据字段\n * 层级数据不提供\n */\n sourceField?: string;\n /** 目标节点数据字段\n * 层级数据不提供\n */\n targetField?: string;\n\n /**\n * 图表布局方向\n */\n direction?: DirectionType;\n /**\n * 节点的对齐类型,所有深度相同的节点,采用什么对齐方式,决定了节点在第几层:\n * - 横向布局的桑基图,用于计算节点x坐标\n * - 纵向布局的桑基图,用于计算节点y坐标\n */\n nodeAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';\n /**\n * 横向布局的桑基图,设置节点Y坐标的对齐方式:\n * 'start' - '顶部对齐'\n * 'end' - '底部对齐'\n * 'middle' - '居中对齐'\n *\n * 纵向布局的桑基图,设置节点X坐标的对齐方式:\n * 'start' - '左对齐'\n * 'end' - '右对齐'\n * 'middle' - '居中对齐'\n * 'parent' - '父节点',从1.12.14版本开始支持\n *\n * @since 1.12.4\n */\n crossNodeAlign?: 'start' | 'end' | 'middle' | 'parent';\n /**\n * 是否反向\n * @since 1.12.2\n */\n inverse?: boolean;\n /**\n * 同一层中两个节点之间的间隙大小\n */\n nodeGap?: number;\n /**\n * 每个节点的宽度,支持三种取值\n * 1. 百分比字符串,例如:{ nodeWidth: '12%' }\n * 2. 以'px'为单位的简单数字,eg: { nodeWidth: 20 }\n * 3. function,通过自定义计算指定nodeWidth\n */\n nodeWidth?: string | number | ((node: SankeyNodeElement) => number);\n /**\n * link宽度,单位px\n */\n linkWidth?: number | ((link: SankeyLinkElement) => number);\n /**\n * link + node 的最小宽度\n */\n minStepWidth?: number;\n /**\n * 数据不为零或空时节点的最小大小\n * - 这个配置可以用来避免数据太小时看不到太细的节点\n * - 建议小于5px\n */\n minNodeHeight?: number;\n /**\n * 数据不为零或空时边的最小大小\n * - 这个配置可以用来避免数据太小的时候看不到太细的链接\n * - 建议小于5px\n * - 当同时指定 `minNodeHeight` 和 `minLinkHeight` 两个选项时,此选项应小于 `minNodeHeight`\n */\n minLinkHeight?: number;\n /**\n * 数据不为零或空时节点的最大大小\n * @since 1.12.14\n */\n maxNodeHeight?: number;\n /**\n * 数据不为零或空时边的最大大小\n * - 当同时指定 `maxNodeHeight` 和 `maxLinkHeight` 两个选项时,此选项应小于 `maxNodeHeight`\n * @since 1.12.14\n */\n maxLinkHeight?: number;\n /** 布局的迭代次数 */\n iterations?: number;\n /** 解析node的key,defaultValue */\n nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);\n /** 按此funtion排序link */\n linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;\n /** 按此funtion排序node */\n nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;\n /** 自定义指定节点层 */\n setNodeLayer?: (datum: SankeyNodeDatum) => number;\n /**\n * 是否丢弃孤立的节点\n * @since 1.11.0\n */\n dropIsolatedNode?: boolean;\n /**\n * set the height of node\n * @since 1.11.0\n */\n nodeHeight?: number | ((node: SankeyNodeElement) => number);\n /**\n * set the height of link\n * @since 1.11.0\n */\n linkHeight?: number | ((link: SankeyLinkElement, sourceNode: SankeyNodeElement, sourceNodeHeight: number) => number);\n /**\n * each node has same height\n * @since 1.11.0\n */\n equalNodeHeight?: boolean;\n /**\n * the layout type of link\n * @since 1.11.0\n */\n linkOverlap?: 'start' | 'center' | 'end';\n\n /** 节点配置 */\n [SeriesMarkNameEnum.node]?: IMarkSpec<IRectMarkSpec>;\n\n /** 边配置 */\n [SeriesMarkNameEnum.link]?: IMarkSpec<ILinkPathMarkSpec>;\n\n /** 联动交互配置 */\n emphasis?: {\n /** 是否开启交互 */\n enable: boolean;\n /**\n * 交互触发类型\n * 默认为‘click'\n */\n trigger?: 'click' | 'hover';\n /**桑基图提供3种在节点上的交互联动效果\n * self: 仅高亮当前节点。\n * adjacency: 高亮当前节点上下游节点和关联的边,淡化其它图形元素。\n * related: 高亮与当前节点相关的整条路径上的节点和边,淡化其它图形元素。 */\n effect: 'self' | 'adjacency' | 'related';\n };\n\n /** 标签配置 */\n [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];\n\n /**\n * 当制定了节点、边的宽度的时候,可以配置这个属性\n * 当宽度大于图表region的宽度、高度大于图表resion高度的时候是否自动产生滚动条\n * @since 1.13.0\n */\n overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n\n /** 进度条配置 */\n // scroll?: IScrollSpec & {\n // /** 是否开启进度条 */\n // enable: boolean;\n // };\n}\n\nexport interface SankeyLinkDatum {\n source: string | number;\n target: string | number;\n value?: number;\n}\n\nexport interface SankeyNodeDatum {\n value?: number;\n}\n\nexport interface HierarchyNodeDatum {\n value?: number;\n children?: HierarchyNodeDatum[];\n}\n\nexport type SankeyData =\n | {\n nodes?: SankeyNodeDatum[];\n links: SankeyLinkDatum[];\n }\n | {\n nodes: HierarchyNodeDatum[];\n };\n\n/**\n * The node element after sankey layout\n */\nexport interface SankeyNodeElement {\n key: string | number;\n index: number;\n /** the depth of node, from source to target */\n depth: number;\n\n /** the depth of node, from target to source */\n endDepth?: number;\n /** the final layer index after layout */\n layer?: number;\n isLastLayer?: boolean;\n value: number;\n datum: SankeyNodeDatum;\n sourceLinks: SankeyLinkElement[];\n targetLinks: SankeyLinkElement[];\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n}\n/**\n * the link element after sankey layout\n */\nexport interface SankeyLinkElement {\n vertical?: boolean;\n index: number;\n source: string | number;\n target: string | number;\n value: number;\n datum: SankeyLinkDatum | SankeyLinkDatum[];\n thickness?: number;\n sourceRect?: { x0: number; x1: number; y0: number; y1: number };\n targetRect?: { x0: number; x1: number; y0: number; y1: number };\n /** this will only be generate in hierarchy node data*/\n parents?: (string | number)[];\n y0?: number;\n y1?: number;\n x0?: number;\n x1?: number;\n}\n\nexport type SankeyLayoutResult = {\n nodes: SankeyNodeElement[];\n links: SankeyLinkElement[];\n columns: SankeyNodeElement[][];\n}[];\n\nexport interface ISankeySeriesTheme {\n [SeriesMarkNameEnum.node]?: IMarkTheme<IRectMarkSpec>;\n [SeriesMarkNameEnum.link]?: IMarkTheme<ILinkPathMarkSpec>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n type: 'sankey';\n\n /**\n * 数据字段配置\n */\n /** 节点名称字段配置 */\n categoryField: string;\n /** 节点之间关系的权重字段 */\n valueField: string;\n /** 来源节点数据字段\n * 层级数据不提供\n */\n sourceField?: string;\n /** 目标节点数据字段\n * 层级数据不提供\n */\n targetField?: string;\n\n /**\n * 图表布局方向\n */\n direction?: DirectionType;\n /**\n * 节点的对齐类型,所有深度相同的节点,采用什么对齐方式,决定了节点在第几层:\n * - 横向布局的桑基图,用于计算节点x坐标\n * - 纵向布局的桑基图,用于计算节点y坐标\n */\n nodeAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';\n /**\n * 横向布局的桑基图,设置节点Y坐标的对齐方式:\n * 'start' - '顶部对齐'\n * 'end' - '底部对齐'\n * 'middle' - '居中对齐'\n *\n * 纵向布局的桑基图,设置节点X坐标的对齐方式:\n * 'start' - '左对齐'\n * 'end' - '右对齐'\n * 'middle' - '居中对齐'\n * 'parent' - '父节点',从1.12.14版本开始支持\n *\n * @since 1.12.4\n */\n crossNodeAlign?: 'start' | 'end' | 'middle' | 'parent';\n /**\n * 是否反向\n * @since 1.12.2\n */\n inverse?: boolean;\n /**\n * 同一层中两个节点之间的间隙大小\n */\n nodeGap?: number;\n /**\n * 每个节点的宽度,支持三种取值\n * 1. 百分比字符串,例如:{ nodeWidth: '12%' }\n * 2. 以'px'为单位的简单数字,eg: { nodeWidth: 20 }\n * 3. function,通过自定义计算指定nodeWidth\n */\n nodeWidth?: string | number | ((node: SankeyNodeElement) => number);\n /**\n * link宽度,单位px\n */\n linkWidth?: number | ((link: SankeyLinkElement) => number);\n /**\n * link + node 的最小宽度\n */\n minStepWidth?: number;\n /**\n * 数据不为零或空时节点的最小大小\n * - 这个配置可以用来避免数据太小时看不到太细的节点\n * - 建议小于5px\n */\n minNodeHeight?: number;\n /**\n * 数据不为零或空时边的最小大小\n * - 这个配置可以用来避免数据太小的时候看不到太细的链接\n * - 建议小于5px\n * - 当同时指定 `minNodeHeight` 和 `minLinkHeight` 两个选项时,此选项应小于 `minNodeHeight`\n */\n minLinkHeight?: number;\n /**\n * 数据不为零或空时节点的最大大小\n * @since 1.12.14\n */\n maxNodeHeight?: number;\n /**\n * 数据不为零或空时边的最大大小\n * - 当同时指定 `maxNodeHeight` 和 `maxLinkHeight` 两个选项时,此选项应小于 `maxNodeHeight`\n * @since 1.12.14\n */\n maxLinkHeight?: number;\n /** 布局的迭代次数 */\n iterations?: number;\n /** 解析node的key,defaultValue */\n nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);\n /** 按此funtion排序link */\n linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;\n /** 按此funtion排序node */\n nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;\n /** 自定义指定节点层 */\n setNodeLayer?: (datum: SankeyNodeDatum) => number;\n /**\n * 是否丢弃孤立的节点\n * @since 1.11.0\n */\n dropIsolatedNode?: boolean;\n /**\n * set the height of node\n * @since 1.11.0\n */\n nodeHeight?: number | ((node: SankeyNodeElement) => number);\n /**\n * set the height of link\n * @since 1.11.0\n */\n linkHeight?: number | ((link: SankeyLinkElement, sourceNode: SankeyNodeElement, sourceNodeHeight: number) => number);\n /**\n * each node has same height\n * @since 1.11.0\n */\n equalNodeHeight?: boolean;\n /**\n * the layout type of link\n * @since 1.11.0\n */\n linkOverlap?: 'start' | 'center' | 'end';\n\n /** 节点配置 */\n [SeriesMarkNameEnum.node]?: IMarkSpec<IRectMarkSpec>;\n\n /** 边配置 */\n [SeriesMarkNameEnum.link]?: IMarkSpec<ILinkPathMarkSpec>;\n\n /** 联动交互配置 */\n emphasis?: {\n /** 是否开启交互 */\n enable: boolean;\n /**\n * 交互触发类型\n * 默认为‘click'\n */\n trigger?: 'click' | 'hover';\n /**桑基图提供3种在节点上的交互联动效果\n * self: 仅高亮当前节点。\n * adjacency: 高亮当前节点上下游节点和关联的边,淡化其它图形元素。\n * related: 高亮与当前节点相关的整条路径上的节点和边,淡化其它图形元素。 */\n effect: 'self' | 'adjacency' | 'related';\n /**\n * 高亮状态\n * @default 'selected'\n * @since 1.13.13\n */\n highlightState?: string;\n /**\n * 失焦状态\n * @default 'blur'\n * @since 1.13.13\n */\n blurState?: string;\n };\n\n /** 标签配置 */\n [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];\n\n /**\n * 当制定了节点、边的宽度的时候,可以配置这个属性\n * 当宽度大于图表region的宽度、高度大于图表resion高度的时候是否自动产生滚动条\n * @since 1.13.0\n */\n overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n\n /** 进度条配置 */\n // scroll?: IScrollSpec & {\n // /** 是否开启进度条 */\n // enable: boolean;\n // };\n}\n\nexport interface SankeyLinkDatum {\n source: string | number;\n target: string | number;\n value?: number;\n}\n\nexport interface SankeyNodeDatum {\n value?: number;\n}\n\nexport interface HierarchyNodeDatum {\n value?: number;\n children?: HierarchyNodeDatum[];\n}\n\nexport type SankeyData =\n | {\n nodes?: SankeyNodeDatum[];\n links: SankeyLinkDatum[];\n }\n | {\n nodes: HierarchyNodeDatum[];\n };\n\n/**\n * The node element after sankey layout\n */\nexport interface SankeyNodeElement {\n key: string | number;\n index: number;\n /** the depth of node, from source to target */\n depth: number;\n\n /** the depth of node, from target to source */\n endDepth?: number;\n /** the final layer index after layout */\n layer?: number;\n isLastLayer?: boolean;\n value: number;\n datum: SankeyNodeDatum;\n sourceLinks: SankeyLinkElement[];\n targetLinks: SankeyLinkElement[];\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n}\n/**\n * the link element after sankey layout\n */\nexport interface SankeyLinkElement {\n vertical?: boolean;\n index: number;\n source: string | number;\n target: string | number;\n value: number;\n datum: SankeyLinkDatum | SankeyLinkDatum[];\n thickness?: number;\n sourceRect?: { x0: number; x1: number; y0: number; y1: number };\n targetRect?: { x0: number; x1: number; y0: number; y1: number };\n /** this will only be generate in hierarchy node data*/\n parents?: (string | number)[];\n y0?: number;\n y1?: number;\n x0?: number;\n x1?: number;\n}\n\nexport type SankeyLayoutResult = {\n nodes: SankeyNodeElement[];\n links: SankeyLinkElement[];\n columns: SankeyNodeElement[][];\n}[];\n\nexport interface ISankeySeriesTheme {\n [SeriesMarkNameEnum.node]?: IMarkTheme<IRectMarkSpec>;\n [SeriesMarkNameEnum.link]?: IMarkTheme<ILinkPathMarkSpec>;\n}\n"]}
|
|
@@ -50,15 +50,16 @@ export declare class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpe
|
|
|
50
50
|
private _createText;
|
|
51
51
|
initAnimation(): void;
|
|
52
52
|
protected initEvent(): void;
|
|
53
|
+
protected _initEmphasisEvent(): void;
|
|
53
54
|
private nodesSeriesDataUpdate;
|
|
54
55
|
private linksSeriesDataUpdate;
|
|
55
56
|
protected _handleEmphasisElement: (params: ExtendEventParam) => void;
|
|
56
|
-
protected _handleClearEmpty: () => void;
|
|
57
|
-
protected _handleNodeAdjacencyClick: (element: IElement) => void;
|
|
58
|
-
protected _handleLinkAdjacencyClick: (element: IGlyphElement) => void;
|
|
59
|
-
protected _handleNodeRelatedClick: (element: IElement) => void;
|
|
60
|
-
protected _handleLinkRelatedClick: (element: IGlyphElement) => void;
|
|
61
|
-
protected _highLightElements(vGrammarElements: IVgrammarMark['elements'], highlightNodes: string[]): void;
|
|
57
|
+
protected _handleClearEmpty: (highlightState: string, blurState: string) => void;
|
|
58
|
+
protected _handleNodeAdjacencyClick: (element: IElement, highlightState: string, blurState: string) => void;
|
|
59
|
+
protected _handleLinkAdjacencyClick: (element: IGlyphElement, highlightState: string, blurState: string) => void;
|
|
60
|
+
protected _handleNodeRelatedClick: (element: IElement, highlightState: string, blurState: string) => void;
|
|
61
|
+
protected _handleLinkRelatedClick: (element: IGlyphElement, highlightState: string, blurState: string) => void;
|
|
62
|
+
protected _highLightElements(vGrammarElements: IVgrammarMark['elements'], highlightNodes: string[], highlightState: string, blurState: string): void;
|
|
62
63
|
protected initTooltip(): void;
|
|
63
64
|
_setNodeOrdinalColorScale(): void;
|
|
64
65
|
getNodeList(): any;
|
|
@@ -31,23 +31,23 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
31
31
|
const sourceName = (0, vutils_1.isNumber)(datum.source) ? this.getNodeList()[datum.source] : datum.source;
|
|
32
32
|
return null === (_g = this._colorScale) || void 0 === _g ? void 0 : _g.scale(sourceName);
|
|
33
33
|
}, this._handleEmphasisElement = params => {
|
|
34
|
-
var _a, _b, _c, _d, _e;
|
|
35
|
-
const emphasisSpec = null !== (_a = this._spec.emphasis) && void 0 !== _a ? _a : {}, element = params.item;
|
|
36
|
-
"adjacency" === emphasisSpec.effect ? element && element.mark === (null === (
|
|
37
|
-
}, this._handleClearEmpty = () => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
35
|
+
const emphasisSpec = null !== (_a = this._spec.emphasis) && void 0 !== _a ? _a : {}, highlightState = null !== (_b = emphasisSpec.highlightState) && void 0 !== _b ? _b : interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, blurState = null !== (_c = emphasisSpec.blurState) && void 0 !== _c ? _c : interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, element = params.item;
|
|
36
|
+
"adjacency" === emphasisSpec.effect ? element && element.mark === (null === (_d = this._nodeMark) || void 0 === _d ? void 0 : _d.getProduct()) ? this._handleNodeAdjacencyClick(element, highlightState, blurState) : element && element.mark === (null === (_e = this._linkMark) || void 0 === _e ? void 0 : _e.getProduct()) ? this._handleLinkAdjacencyClick(element, highlightState, blurState) : this._handleClearEmpty(highlightState, blurState) : "related" === emphasisSpec.effect && (element && element.mark === (null === (_f = this._nodeMark) || void 0 === _f ? void 0 : _f.getProduct()) ? this._handleNodeRelatedClick(element, highlightState, blurState) : element && element.mark === (null === (_g = this._linkMark) || void 0 === _g ? void 0 : _g.getProduct()) ? this._handleLinkRelatedClick(element, highlightState, blurState) : this._handleClearEmpty(highlightState, blurState));
|
|
37
|
+
}, this._handleClearEmpty = (highlightState, blurState) => {
|
|
38
38
|
var _a, _b;
|
|
39
39
|
if (!this._needClear) return;
|
|
40
40
|
const allNodeElements = null === (_a = this._nodeMark) || void 0 === _a ? void 0 : _a.getProductElements();
|
|
41
41
|
if (!allNodeElements || !allNodeElements.length) return;
|
|
42
42
|
const allLinkElements = null === (_b = this._linkMark) || void 0 === _b ? void 0 : _b.getProductElements();
|
|
43
43
|
if (!allLinkElements || !allLinkElements.length) return;
|
|
44
|
-
const states = [
|
|
44
|
+
const states = [ highlightState, blurState ];
|
|
45
45
|
allNodeElements.forEach((el => {
|
|
46
46
|
el.removeState(states);
|
|
47
47
|
})), allLinkElements.forEach((el => {
|
|
48
48
|
el.removeState(states);
|
|
49
49
|
})), this._needClear = !1;
|
|
50
|
-
}, this._handleNodeAdjacencyClick = element => {
|
|
50
|
+
}, this._handleNodeAdjacencyClick = (element, highlightState, blurState) => {
|
|
51
51
|
const nodeDatum = element.getDatum(), highlightNodes = [ nodeDatum.key ];
|
|
52
52
|
if (this._linkMark) {
|
|
53
53
|
const allLinkElements = this._linkMark.getProductElements();
|
|
@@ -55,30 +55,29 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
55
55
|
allLinkElements.forEach(((linkEl, i) => {
|
|
56
56
|
const linkDatum = linkEl.getDatum();
|
|
57
57
|
linkDatum.source === nodeDatum.key ? (highlightNodes.includes(linkDatum.target) || highlightNodes.push(linkDatum.target),
|
|
58
|
-
linkEl.removeState(
|
|
59
|
-
linkEl.addState(
|
|
60
|
-
linkEl.
|
|
61
|
-
linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS)) : (linkEl.removeState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),
|
|
62
|
-
linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE));
|
|
58
|
+
linkEl.removeState(blurState), linkEl.addState(highlightState)) : linkDatum.target === nodeDatum.key ? (highlightNodes.includes(linkDatum.source) || highlightNodes.push(linkDatum.source),
|
|
59
|
+
linkEl.removeState(blurState), linkEl.addState(highlightState)) : (linkEl.removeState(highlightState),
|
|
60
|
+
linkEl.addState(blurState));
|
|
63
61
|
}));
|
|
64
62
|
}
|
|
65
|
-
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes),
|
|
63
|
+
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes, highlightState, blurState),
|
|
66
64
|
this._needClear = !0;
|
|
67
|
-
}, this._handleLinkAdjacencyClick = element => {
|
|
65
|
+
}, this._handleLinkAdjacencyClick = (element, highlightState, blurState) => {
|
|
68
66
|
const curLinkDatum = element.getDatum(), highlightNodes = [ curLinkDatum.source, curLinkDatum.target ];
|
|
69
67
|
if (this._linkMark) {
|
|
70
68
|
const allLinkElements = this._linkMark.getProductElements();
|
|
71
69
|
if (!allLinkElements || !allLinkElements.length) return;
|
|
72
70
|
allLinkElements.forEach((linkEl => {
|
|
73
|
-
linkEl === element ? (linkEl.removeState(
|
|
74
|
-
|
|
71
|
+
linkEl === element ? (linkEl.removeState(blurState), linkEl.addState(highlightState, {
|
|
72
|
+
ratio: 1
|
|
73
|
+
})) : (linkEl.removeState(highlightState), linkEl.addState(blurState, {
|
|
75
74
|
ratio: 1
|
|
76
|
-
}))
|
|
75
|
+
}));
|
|
77
76
|
}));
|
|
78
77
|
}
|
|
79
|
-
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes),
|
|
78
|
+
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes, highlightState, blurState),
|
|
80
79
|
this._needClear = !0;
|
|
81
|
-
}, this._handleNodeRelatedClick = element => {
|
|
80
|
+
}, this._handleNodeRelatedClick = (element, highlightState, blurState) => {
|
|
82
81
|
var _a;
|
|
83
82
|
const nodeDatum = element.getDatum(), allNodeElements = this._nodeMark.getProductElements();
|
|
84
83
|
if (!allNodeElements || !allNodeElements.length) return;
|
|
@@ -131,12 +130,11 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
131
130
|
if (!allLinkElements || !allLinkElements.length) return;
|
|
132
131
|
allLinkElements.forEach(((linkEl, i) => {
|
|
133
132
|
var _a;
|
|
134
|
-
highlightLinks.includes(null !== (_a = linkEl.getDatum().key) && void 0 !== _a ? _a : linkEl.getDatum().index) ? (linkEl.removeState(
|
|
135
|
-
linkEl.addState(
|
|
136
|
-
linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE));
|
|
133
|
+
highlightLinks.includes(null !== (_a = linkEl.getDatum().key) && void 0 !== _a ? _a : linkEl.getDatum().index) ? (linkEl.removeState(blurState),
|
|
134
|
+
linkEl.addState(highlightState)) : (linkEl.removeState(highlightState), linkEl.addState(blurState));
|
|
137
135
|
}));
|
|
138
136
|
}
|
|
139
|
-
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes);
|
|
137
|
+
this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes, highlightState, blurState);
|
|
140
138
|
} else {
|
|
141
139
|
const highlightNodes = [ nodeDatum.key ], upstreamLinks = nodeDatum.targetLinks.reduce(((res, link) => ((0,
|
|
142
140
|
vutils_1.array)(link.datum).forEach((dividedLink => {
|
|
@@ -156,29 +154,27 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
156
154
|
highlightNodes.includes(linkDatum.source) || highlightNodes.push(linkDatum.source),
|
|
157
155
|
highlightNodes.includes(linkDatum.target) || highlightNodes.push(linkDatum.target);
|
|
158
156
|
const ratio = selectedDatum.reduce(((sum, d) => sum + d.value), 0) / linkDatum.value;
|
|
159
|
-
return linkEl.removeState(
|
|
160
|
-
void linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
157
|
+
return linkEl.removeState(blurState), void linkEl.addState(highlightState, {
|
|
161
158
|
ratio: ratio
|
|
162
159
|
});
|
|
163
160
|
}
|
|
164
161
|
if (upSelectedLink) return highlightNodes.includes(linkDatum.source) || highlightNodes.push(linkDatum.source),
|
|
165
162
|
highlightNodes.includes(linkDatum.target) || highlightNodes.push(linkDatum.target),
|
|
166
|
-
linkEl.removeState(
|
|
167
|
-
void linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
163
|
+
linkEl.removeState(blurState), void linkEl.addState(highlightState, {
|
|
168
164
|
ratio: upSelectedLink.value / linkDatum.value
|
|
169
165
|
});
|
|
170
|
-
linkEl.removeState(
|
|
171
|
-
})), this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes);
|
|
166
|
+
linkEl.removeState(highlightState), linkEl.addState(blurState);
|
|
167
|
+
})), this._nodeMark && this._highLightElements(this._nodeMark.getProductElements(), highlightNodes, highlightState, blurState);
|
|
172
168
|
}
|
|
173
169
|
this._needClear = !0;
|
|
174
|
-
}, this._handleLinkRelatedClick = element => {
|
|
170
|
+
}, this._handleLinkRelatedClick = (element, highlightState, blurState) => {
|
|
175
171
|
var _a;
|
|
176
172
|
const allNodeElements = this._nodeMark.getProductElements();
|
|
177
173
|
if (!allNodeElements || !allNodeElements.length) return;
|
|
178
174
|
const allLinkElements = this._linkMark.getProductElements();
|
|
179
175
|
if (!allLinkElements || !allLinkElements.length) return;
|
|
180
176
|
if ("source" === ((null === (_a = element.getDatum()) || void 0 === _a ? void 0 : _a.parents) ? "parents" : "source")) {
|
|
181
|
-
const states = [
|
|
177
|
+
const states = [ highlightState, blurState ];
|
|
182
178
|
this._linkMark && allLinkElements.forEach((linkEl => {
|
|
183
179
|
linkEl.removeState(states);
|
|
184
180
|
})), this._nodeMark && allNodeElements.forEach((el => {
|
|
@@ -202,8 +198,8 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
202
198
|
}
|
|
203
199
|
})), allLinkElements.forEach((linkEl => {
|
|
204
200
|
const linkDatum = linkEl.getDatum(), originalDatum = linkDatum.datum;
|
|
205
|
-
if (linkDatum.source === curLinkDatum.source && linkDatum.target === curLinkDatum.target) return linkEl.removeState(
|
|
206
|
-
void linkEl.addState(
|
|
201
|
+
if (linkDatum.source === curLinkDatum.source && linkDatum.target === curLinkDatum.target) return linkEl.removeState(blurState),
|
|
202
|
+
void linkEl.addState(highlightState, {
|
|
207
203
|
ratio: 1
|
|
208
204
|
});
|
|
209
205
|
const selectedDatum = originalDatum ? originalDatum.filter((entry => {
|
|
@@ -217,27 +213,25 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
217
213
|
var _a;
|
|
218
214
|
return par.key === curLinkDatum.source && (null === (_a = entry.parents[index + 1]) || void 0 === _a ? void 0 : _a.key) === curLinkDatum.target;
|
|
219
215
|
})))).reduce(((sum, d) => sum + d.value), 0), ratio = val / linkDatum.value;
|
|
220
|
-
return linkEl.removeState(
|
|
221
|
-
void linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
216
|
+
return linkEl.removeState(blurState), void linkEl.addState(highlightState, {
|
|
222
217
|
ratio: ratio
|
|
223
218
|
});
|
|
224
219
|
}
|
|
225
220
|
const upSelectedLink = upstreamLinks.find((upLink => upLink.source === linkDatum.source && upLink.target === linkDatum.target));
|
|
226
221
|
if (upSelectedLink) return highlightNodes.includes(linkDatum.source) || highlightNodes.push(linkDatum.source),
|
|
227
222
|
highlightNodes.includes(linkDatum.target) || highlightNodes.push(linkDatum.target),
|
|
228
|
-
linkEl.removeState(
|
|
229
|
-
void linkEl.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
223
|
+
linkEl.removeState(blurState), void linkEl.addState(highlightState, {
|
|
230
224
|
ratio: upSelectedLink.value / linkDatum.value
|
|
231
225
|
});
|
|
232
|
-
linkEl.removeState(
|
|
233
|
-
})), this._highLightElements(allNodeElements, highlightNodes);
|
|
226
|
+
linkEl.removeState(highlightState), linkEl.addState(blurState);
|
|
227
|
+
})), this._highLightElements(allNodeElements, highlightNodes, highlightState, blurState);
|
|
234
228
|
}
|
|
235
229
|
this._needClear = !0;
|
|
236
230
|
};
|
|
237
231
|
}
|
|
238
232
|
get direction() {
|
|
239
|
-
var _a;
|
|
240
|
-
return null !== (_a = this._spec.direction) && void 0 !==
|
|
233
|
+
var _a, _b;
|
|
234
|
+
return null !== (_b = null === (_a = this._spec) || void 0 === _a ? void 0 : _a.direction) && void 0 !== _b ? _b : "horizontal";
|
|
241
235
|
}
|
|
242
236
|
getCategoryField() {
|
|
243
237
|
return this._categoryField;
|
|
@@ -471,10 +465,14 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
471
465
|
utils_1.userAnimationConfig)("link", this._spec, this._markAttributeContext)));
|
|
472
466
|
}
|
|
473
467
|
initEvent() {
|
|
474
|
-
var _a, _b
|
|
468
|
+
var _a, _b;
|
|
475
469
|
super.initEvent(), null === (_a = this._nodesSeriesData.getDataView()) || void 0 === _a || _a.target.addListener("change", this.nodesSeriesDataUpdate.bind(this)),
|
|
476
|
-
null === (_b = this._linksSeriesData.getDataView()) || void 0 === _b || _b.target.addListener("change", this.linksSeriesDataUpdate.bind(this))
|
|
477
|
-
|
|
470
|
+
null === (_b = this._linksSeriesData.getDataView()) || void 0 === _b || _b.target.addListener("change", this.linksSeriesDataUpdate.bind(this)),
|
|
471
|
+
this._initEmphasisEvent();
|
|
472
|
+
}
|
|
473
|
+
_initEmphasisEvent() {
|
|
474
|
+
var _a;
|
|
475
|
+
const emphasisSpec = null !== (_a = this._spec.emphasis) && void 0 !== _a ? _a : {};
|
|
478
476
|
if (!0 !== this._option.disableTriggerEvent && emphasisSpec.enable && ("adjacency" === emphasisSpec.effect || "related" === emphasisSpec.effect)) {
|
|
479
477
|
const event = "hover" === emphasisSpec.trigger ? "pointerover" : "pointerdown";
|
|
480
478
|
this.event.on(event, {
|
|
@@ -488,10 +486,9 @@ class SankeySeries extends cartesian_1.CartesianSeries {
|
|
|
488
486
|
linksSeriesDataUpdate() {
|
|
489
487
|
this._linksSeriesData.updateData();
|
|
490
488
|
}
|
|
491
|
-
_highLightElements(vGrammarElements, highlightNodes) {
|
|
489
|
+
_highLightElements(vGrammarElements, highlightNodes, highlightState, blurState) {
|
|
492
490
|
vGrammarElements && vGrammarElements.length && vGrammarElements.forEach((el => {
|
|
493
|
-
el.removeState([
|
|
494
|
-
highlightNodes.includes(el.getDatum().key) ? el.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS) : el.addState(interface_1.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
491
|
+
el.removeState([ blurState, highlightState ]), highlightNodes.includes(el.getDatum().key) ? el.addState(highlightState) : el.addState(blurState);
|
|
495
492
|
}));
|
|
496
493
|
}
|
|
497
494
|
initTooltip() {
|