Skip to content

Commit 30c53fc

Browse files
committed
feat: support compare sankey chart
1 parent d6419e8 commit 30c53fc

File tree

10 files changed

+74
-59
lines changed

10 files changed

+74
-59
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 47 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@visactor/vchart-extension": "workspace:2.0.1",
1919
"@visactor/vchart-theme": "~1.6.6",
2020
"@visactor/vmind": "1.2.4-alpha.5",
21-
"@visactor/vutils": "~1.0.6",
21+
"@visactor/vutils": "~1.0.9",
2222
"@visactor/vrender": "1.0.9",
2323
"@visactor/vrender-kits": "1.0.9",
2424
"@visactor/vtable": "1.19.0-alpha.0",

packages/openinula-vchart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"dependencies": {
3131
"@visactor/vchart": "workspace:2.0.1",
32-
"@visactor/vutils": "~1.0.6",
32+
"@visactor/vutils": "~1.0.9",
3333
"@visactor/vrender-core": "1.0.9",
3434
"@visactor/vrender-kits": "1.0.9",
3535
"react-is": "^18.2.0"

packages/react-vchart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"@visactor/vchart": "workspace:2.0.1",
3232
"@visactor/vchart-extension": "workspace:2.0.1",
33-
"@visactor/vutils": "~1.0.6",
33+
"@visactor/vutils": "~1.0.9",
3434
"@visactor/vrender-core": "1.0.9",
3535
"@visactor/vrender-kits": "1.0.9",
3636
"react-is": "^18.2.0"

packages/vchart/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@
118118
"cross-env": "^7.0.3"
119119
},
120120
"dependencies": {
121-
"@visactor/vutils": "~1.0.6",
122-
"@visactor/vdataset": "~1.0.6",
123-
"@visactor/vscale": "~1.0.6",
124-
"@visactor/vlayouts": "~1.0.6",
121+
"@visactor/vutils": "~1.0.9",
122+
"@visactor/vdataset": "~1.0.9",
123+
"@visactor/vscale": "~1.0.9",
124+
"@visactor/vlayouts": "~1.0.9",
125125
"@visactor/vrender-core": "1.0.9",
126126
"@visactor/vrender-kits": "1.0.9",
127127
"@visactor/vrender-components": "1.0.9",

packages/vchart/src/chart/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { RangeColumnChart, registerRangeColumnChart } from './range-column';
3939
import type { IRoseChartSpec } from './rose';
4040
import { RoseChart, registerRoseChart } from './rose';
4141
import type { ISankeyChartSpec } from './sankey';
42-
import { SankeyChart, registerSankeyChart } from './sankey';
42+
import { SankeyChart, registerSankeyChart, SankeyChartSpecTransformer } from './sankey';
4343
import type { IScatterChartSpec } from './scatter';
4444
import { ScatterChart, registerScatterChart } from './scatter';
4545
import type { ISequenceChartSpec } from './sequence';
@@ -94,6 +94,7 @@ export {
9494
RangeAreaChart,
9595
RoseChart,
9696
SankeyChart,
97+
SankeyChartSpecTransformer,
9798
ScatterChart,
9899
SunburstChart,
99100
SequenceChart,

packages/vchart/src/series/sankey/sankey.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
5151
static readonly mark: SeriesMarkMap = sankeySeriesMark;
5252
static readonly builtInTheme = { sankey };
5353

54-
private _nodeMark: IRectMark;
55-
private _linkMark: ILinkPathMark;
54+
protected _nodeMark: IRectMark;
55+
protected _linkMark: ILinkPathMark;
5656

5757
private _nodeLayoutZIndex = LayoutZIndex.Node;
5858
private _labelLayoutZIndex = LayoutZIndex.Label;
@@ -65,7 +65,7 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
6565
protected _categoryField!: string;
6666
private _colorScale: IBaseScale;
6767
private _nodeList: (string | number)[];
68-
private _needClear: boolean;
68+
protected _needClear: boolean;
6969

7070
get direction() {
7171
return this._spec.direction ?? 'horizontal';
@@ -500,7 +500,7 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
500500
}
501501
};
502502

503-
protected _handleClearEmpty = () => {
503+
protected _handleClearEmpty() {
504504
if (!this._needClear) {
505505
return;
506506
}
@@ -529,9 +529,9 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
529529
});
530530

531531
this._needClear = false;
532-
};
532+
}
533533

534-
protected _handleNodeAdjacencyClick = (graphic: IMarkGraphic) => {
534+
protected _handleNodeAdjacencyClick(graphic: IMarkGraphic) {
535535
const nodeDatum = getDatumOfGraphic(graphic) as Datum;
536536
const highlightNodes: string[] = [nodeDatum.key];
537537

@@ -573,9 +573,9 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
573573
}
574574

575575
this._needClear = true;
576-
};
576+
}
577577

578-
protected _handleLinkAdjacencyClick = (graphic: IMarkGraphic) => {
578+
protected _handleLinkAdjacencyClick(graphic: IMarkGraphic) {
579579
const curLinkDatum = getDatumOfGraphic(graphic) as Datum;
580580
const highlightNodes: string[] = [curLinkDatum.source, curLinkDatum.target];
581581

@@ -601,9 +601,9 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
601601
}
602602

603603
this._needClear = true;
604-
};
604+
}
605605

606-
protected _handleNodeRelatedClick = (graphic: IMarkGraphic) => {
606+
protected _handleNodeRelatedClick(graphic: IMarkGraphic) {
607607
const nodeDatum = getDatumOfGraphic(graphic) as Datum;
608608
const allNodeElements = this._nodeMark.getGraphics();
609609

@@ -824,9 +824,9 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
824824
}
825825

826826
this._needClear = true;
827-
};
827+
}
828828

829-
protected _handleLinkRelatedClick = (graphic: IMarkGraphic) => {
829+
protected _handleLinkRelatedClick(graphic: IMarkGraphic) {
830830
const allNodeElements = this._nodeMark.getGraphics();
831831

832832
if (!allNodeElements || !allNodeElements.length) {
@@ -966,9 +966,9 @@ export class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpec> exten
966966
}
967967

968968
this._needClear = true;
969-
};
969+
}
970970

971-
protected _highLightElements(graphics: IMarkGraphic[], highlightNodes: string[]) {
971+
protected _highLightElements(graphics: IMarkGraphic[], highlightNodes: (string | number)[]) {
972972
if (!graphics || !graphics.length) {
973973
return;
974974
}

packages/vstory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@visactor/vrender-core": "1.0.9",
2525
"@visactor/vrender-kits": "1.0.9",
2626
"@visactor/vrender-components": "1.0.9",
27-
"@visactor/vutils": "~1.0.6"
27+
"@visactor/vutils": "~1.0.9"
2828
},
2929
"devDependencies": {
3030
"@internal/bundler": "workspace:*",

packages/vutils-extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"test-watch": "DEBUG_MODE=1 jest --watch"
2626
},
2727
"dependencies": {
28-
"@visactor/vutils": "~1.0.6",
29-
"@visactor/vdataset": "~1.0.6"
28+
"@visactor/vutils": "~1.0.9",
29+
"@visactor/vdataset": "~1.0.9"
3030
},
3131
"devDependencies": {
3232
"@internal/bundler": "workspace:*",

0 commit comments

Comments
 (0)