@visactor/vchart 1.1.0-beta.2 → 1.1.0-beta.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/build/index.js +531 -150
- package/build/index.min.js +1 -1
- package/cjs/chart/base-chart.d.ts +2 -1
- package/cjs/chart/base-chart.js +12 -0
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +3 -3
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/word-cloud/word-cloud-3d.js +1 -2
- package/cjs/chart/word-cloud/word-cloud-3d.js.map +1 -1
- package/cjs/chart/word-cloud/word-cloud.js +1 -2
- package/cjs/chart/word-cloud/word-cloud.js.map +1 -1
- package/cjs/compile/compiler.js +2 -1
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +1 -0
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +6 -14
- package/cjs/component/axis/base-axis.js +10 -1
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +1 -1
- package/cjs/component/axis/cartesian/axis.js +8 -3
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/cartesian/interface/spec.d.ts +9 -2
- package/cjs/component/axis/cartesian/interface/spec.js.map +1 -1
- package/cjs/component/axis/interface.d.ts +9 -0
- package/cjs/component/axis/interface.js.map +1 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +4 -0
- package/cjs/component/axis/mixin/linear-axis-mixin.js +6 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/cjs/component/base/base-component.js +4 -2
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/crosshair/base.js +26 -18
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/marker/base-marker.js +2 -1
- package/cjs/component/marker/base-marker.js.map +1 -1
- package/cjs/constant/event.d.ts +1 -0
- package/cjs/constant/event.js +4 -4
- package/cjs/constant/event.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/event/event-dispatcher.d.ts +2 -2
- package/cjs/event/event-dispatcher.js +23 -18
- package/cjs/event/event-dispatcher.js.map +1 -1
- package/cjs/event/event.d.ts +2 -2
- package/cjs/event/event.js +2 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/interface.d.ts +2 -2
- package/cjs/event/interface.js.map +1 -1
- package/cjs/interaction/drill/drillable.js +3 -2
- package/cjs/interaction/drill/drillable.js.map +1 -1
- package/cjs/interaction/zoom/zoomable.d.ts +1 -1
- package/cjs/interaction/zoom/zoomable.js +16 -15
- package/cjs/interaction/zoom/zoomable.js.map +1 -1
- package/cjs/plugin/components/axis-sync-plugin/axis-sync.d.ts +11 -0
- package/cjs/plugin/components/axis-sync-plugin/axis-sync.js +53 -0
- package/cjs/plugin/components/axis-sync-plugin/axis-sync.js.map +1 -0
- package/cjs/plugin/components/axis-sync-plugin/index.d.ts +1 -0
- package/cjs/plugin/components/axis-sync-plugin/index.js +21 -0
- package/cjs/plugin/components/axis-sync-plugin/index.js.map +1 -0
- package/cjs/plugin/components/axis-sync-plugin/tick-align-transform.d.ts +7 -0
- package/cjs/plugin/components/axis-sync-plugin/tick-align-transform.js +36 -0
- package/cjs/plugin/components/axis-sync-plugin/tick-align-transform.js.map +1 -0
- package/cjs/plugin/components/axis-sync-plugin/zero-align-transform.d.ts +15 -0
- package/cjs/plugin/components/axis-sync-plugin/zero-align-transform.js +123 -0
- package/cjs/plugin/components/axis-sync-plugin/zero-align-transform.js.map +1 -0
- package/cjs/plugin/components/index.d.ts +2 -0
- package/cjs/plugin/components/index.js +3 -2
- package/cjs/plugin/components/index.js.map +1 -1
- package/cjs/plugin/components/interface.d.ts +2 -0
- package/cjs/plugin/components/interface.js.map +1 -1
- package/cjs/series/word-cloud/base.d.ts +2 -2
- package/cjs/series/word-cloud/base.js +42 -43
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/series/word-cloud/interface.d.ts +1 -2
- package/cjs/series/word-cloud/interface.js.map +1 -1
- package/cjs/series/word-cloud/word-cloud-3d.js +37 -37
- package/cjs/series/word-cloud/word-cloud-3d.js.map +1 -1
- package/esm/chart/base-chart.d.ts +2 -1
- package/esm/chart/base-chart.js +12 -0
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +3 -3
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/word-cloud/word-cloud-3d.js +1 -2
- package/esm/chart/word-cloud/word-cloud-3d.js.map +1 -1
- package/esm/chart/word-cloud/word-cloud.js +1 -2
- package/esm/chart/word-cloud/word-cloud.js.map +1 -1
- package/esm/compile/compiler.js +2 -1
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +1 -0
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +6 -14
- package/esm/component/axis/base-axis.js +10 -1
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +1 -1
- package/esm/component/axis/cartesian/axis.js +8 -3
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/cartesian/interface/spec.d.ts +9 -2
- package/esm/component/axis/cartesian/interface/spec.js.map +1 -1
- package/esm/component/axis/interface.d.ts +9 -0
- package/esm/component/axis/interface.js.map +1 -1
- package/esm/component/axis/mixin/linear-axis-mixin.d.ts +4 -0
- package/esm/component/axis/mixin/linear-axis-mixin.js +6 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/esm/component/base/base-component.js +4 -2
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/crosshair/base.js +25 -17
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/marker/base-marker.js +2 -1
- package/esm/component/marker/base-marker.js.map +1 -1
- package/esm/constant/event.d.ts +1 -0
- package/esm/constant/event.js +4 -4
- package/esm/constant/event.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/event/event-dispatcher.d.ts +2 -2
- package/esm/event/event-dispatcher.js +23 -18
- package/esm/event/event-dispatcher.js.map +1 -1
- package/esm/event/event.d.ts +2 -2
- package/esm/event/event.js +2 -2
- package/esm/event/event.js.map +1 -1
- package/esm/event/interface.d.ts +2 -2
- package/esm/event/interface.js.map +1 -1
- package/esm/interaction/drill/drillable.js +3 -2
- package/esm/interaction/drill/drillable.js.map +1 -1
- package/esm/interaction/zoom/zoomable.d.ts +1 -1
- package/esm/interaction/zoom/zoomable.js +16 -15
- package/esm/interaction/zoom/zoomable.js.map +1 -1
- package/esm/plugin/components/axis-sync-plugin/axis-sync.d.ts +11 -0
- package/esm/plugin/components/axis-sync-plugin/axis-sync.js +55 -0
- package/esm/plugin/components/axis-sync-plugin/axis-sync.js.map +1 -0
- package/esm/plugin/components/axis-sync-plugin/index.d.ts +1 -0
- package/esm/plugin/components/axis-sync-plugin/index.js +2 -0
- package/esm/plugin/components/axis-sync-plugin/index.js.map +1 -0
- package/esm/plugin/components/axis-sync-plugin/tick-align-transform.d.ts +7 -0
- package/esm/plugin/components/axis-sync-plugin/tick-align-transform.js +30 -0
- package/esm/plugin/components/axis-sync-plugin/tick-align-transform.js.map +1 -0
- package/esm/plugin/components/axis-sync-plugin/zero-align-transform.d.ts +15 -0
- package/esm/plugin/components/axis-sync-plugin/zero-align-transform.js +115 -0
- package/esm/plugin/components/axis-sync-plugin/zero-align-transform.js.map +1 -0
- package/esm/plugin/components/index.d.ts +2 -0
- package/esm/plugin/components/index.js +4 -1
- package/esm/plugin/components/index.js.map +1 -1
- package/esm/plugin/components/interface.d.ts +2 -0
- package/esm/plugin/components/interface.js.map +1 -1
- package/esm/series/word-cloud/base.d.ts +2 -2
- package/esm/series/word-cloud/base.js +42 -43
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/series/word-cloud/interface.d.ts +1 -2
- package/esm/series/word-cloud/interface.js.map +1 -1
- package/esm/series/word-cloud/word-cloud-3d.js +37 -37
- package/esm/series/word-cloud/word-cloud-3d.js.map +1 -1
- package/package.json +9 -8
- package/cjs/series/treemap/config.d.ts +0 -44
- package/cjs/series/treemap/config.js +0 -51
- package/cjs/series/treemap/config.js.map +0 -1
- package/esm/series/treemap/config.d.ts +0 -44
- package/esm/series/treemap/config.js +0 -49
- package/esm/series/treemap/config.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -47984,6 +47984,7 @@
|
|
|
47984
47984
|
ChartEvent["viewDataStatisticsUpdate"] = "viewDataStatisticsUpdate";
|
|
47985
47985
|
ChartEvent["markDeltaYUpdate"] = "markDeltaYUpdate";
|
|
47986
47986
|
ChartEvent["viewDataLabelUpdate"] = "viewDataLabelUpdate";
|
|
47987
|
+
ChartEvent["scaleDomainUpdate"] = "scaleDomainUpdate";
|
|
47987
47988
|
ChartEvent["scaleUpdate"] = "scaleUpdate";
|
|
47988
47989
|
ChartEvent["dataZoomChange"] = "dataZoomChange";
|
|
47989
47990
|
ChartEvent["drill"] = "drill";
|
|
@@ -49987,8 +49988,8 @@
|
|
|
49987
49988
|
}
|
|
49988
49989
|
return this;
|
|
49989
49990
|
}
|
|
49990
|
-
emit(eType, params) {
|
|
49991
|
-
this._eventDispatcher.dispatch(eType, params);
|
|
49991
|
+
emit(eType, params, level) {
|
|
49992
|
+
this._eventDispatcher.dispatch(eType, params, level);
|
|
49992
49993
|
return this;
|
|
49993
49994
|
}
|
|
49994
49995
|
release() {
|
|
@@ -50104,25 +50105,31 @@
|
|
|
50104
50105
|
}
|
|
50105
50106
|
return this;
|
|
50106
50107
|
}
|
|
50107
|
-
dispatch(eType, params) {
|
|
50108
|
+
dispatch(eType, params, level) {
|
|
50108
50109
|
const bubble = this.getEventBubble(params.source || Event_Source_Type.chart).get(eType);
|
|
50109
50110
|
if (!bubble) {
|
|
50110
50111
|
return this;
|
|
50111
50112
|
}
|
|
50112
50113
|
let stopBubble = false;
|
|
50113
|
-
|
|
50114
|
-
|
|
50115
|
-
if (!stopBubble) {
|
|
50116
|
-
const handlers = bubble.getHandlers(Event_Bubble_Level.model);
|
|
50114
|
+
if (level) {
|
|
50115
|
+
const handlers = bubble.getHandlers(level);
|
|
50117
50116
|
stopBubble = this._invoke(handlers, eType, params);
|
|
50118
50117
|
}
|
|
50119
|
-
|
|
50120
|
-
const handlers = bubble.getHandlers(Event_Bubble_Level.
|
|
50121
|
-
stopBubble = this._invoke(handlers, eType, params);
|
|
50122
|
-
}
|
|
50123
|
-
if (!stopBubble) {
|
|
50124
|
-
const handlers = bubble.getHandlers(Event_Bubble_Level.vchart);
|
|
50118
|
+
else {
|
|
50119
|
+
const handlers = bubble.getHandlers(Event_Bubble_Level.mark);
|
|
50125
50120
|
stopBubble = this._invoke(handlers, eType, params);
|
|
50121
|
+
if (!stopBubble) {
|
|
50122
|
+
const handlers = bubble.getHandlers(Event_Bubble_Level.model);
|
|
50123
|
+
stopBubble = this._invoke(handlers, eType, params);
|
|
50124
|
+
}
|
|
50125
|
+
if (!stopBubble) {
|
|
50126
|
+
const handlers = bubble.getHandlers(Event_Bubble_Level.chart);
|
|
50127
|
+
stopBubble = this._invoke(handlers, eType, params);
|
|
50128
|
+
}
|
|
50129
|
+
if (!stopBubble) {
|
|
50130
|
+
const handlers = bubble.getHandlers(Event_Bubble_Level.vchart);
|
|
50131
|
+
stopBubble = this._invoke(handlers, eType, params);
|
|
50132
|
+
}
|
|
50126
50133
|
}
|
|
50127
50134
|
return this;
|
|
50128
50135
|
}
|
|
@@ -50151,7 +50158,7 @@
|
|
|
50151
50158
|
if (filter.nodeName && get(params, 'node.name') !== filter.nodeName) {
|
|
50152
50159
|
return false;
|
|
50153
50160
|
}
|
|
50154
|
-
if (filter.markName &&
|
|
50161
|
+
if (filter.markName && params?.mark?.name !== filter.markName) {
|
|
50155
50162
|
return false;
|
|
50156
50163
|
}
|
|
50157
50164
|
let modelType = params.model?.type;
|
|
@@ -50167,8 +50174,9 @@
|
|
|
50167
50174
|
return true;
|
|
50168
50175
|
}
|
|
50169
50176
|
_prepareParams(filter, params) {
|
|
50170
|
-
if (filter.markName && params.itemMap) {
|
|
50171
|
-
const
|
|
50177
|
+
if (filter.markName && params.mark && params.itemMap) {
|
|
50178
|
+
const markId = params.mark.getProductId();
|
|
50179
|
+
const item = params.itemMap.get(markId);
|
|
50172
50180
|
const datum = item?.getDatum();
|
|
50173
50181
|
return { ...params, item, datum };
|
|
50174
50182
|
}
|
|
@@ -50628,6 +50636,7 @@
|
|
|
50628
50636
|
return;
|
|
50629
50637
|
}
|
|
50630
50638
|
chart.compile();
|
|
50639
|
+
chart.afterCompile();
|
|
50631
50640
|
this.updateDepend();
|
|
50632
50641
|
}
|
|
50633
50642
|
async renderAsync(morphConfig) {
|
|
@@ -54101,7 +54110,7 @@
|
|
|
54101
54110
|
VChart.useMark([ComponentMark, GroupMark]);
|
|
54102
54111
|
Factory.registerRegion('region', Region);
|
|
54103
54112
|
Factory.registerLayout('base', Layout);
|
|
54104
|
-
const version = "1.1.0-beta.
|
|
54113
|
+
const version = "1.1.0-beta.3";
|
|
54105
54114
|
|
|
54106
54115
|
var SeriesMarkNameEnum;
|
|
54107
54116
|
(function (SeriesMarkNameEnum) {
|
|
@@ -55278,6 +55287,17 @@
|
|
|
55278
55287
|
this.compileSeries();
|
|
55279
55288
|
this.compileComponents();
|
|
55280
55289
|
}
|
|
55290
|
+
afterCompile() {
|
|
55291
|
+
this.getAllRegions().forEach(r => {
|
|
55292
|
+
r.afterCompile?.();
|
|
55293
|
+
});
|
|
55294
|
+
this.getAllSeries().forEach(s => {
|
|
55295
|
+
s.afterCompile?.();
|
|
55296
|
+
});
|
|
55297
|
+
this.getAllComponents().forEach(c => {
|
|
55298
|
+
c.afterCompile?.();
|
|
55299
|
+
});
|
|
55300
|
+
}
|
|
55281
55301
|
compileLayout() {
|
|
55282
55302
|
const { width, height } = this.getCanvasRect();
|
|
55283
55303
|
this.getCompiler().setSize(width, height);
|
|
@@ -68714,14 +68734,10 @@
|
|
|
68714
68734
|
_fillingFontPadding;
|
|
68715
68735
|
_wordCloudConfig;
|
|
68716
68736
|
_wordCloudShapeConfig;
|
|
68717
|
-
|
|
68718
|
-
_paddingTop;
|
|
68737
|
+
_padding;
|
|
68719
68738
|
setAttrFromSpec() {
|
|
68720
68739
|
super.setAttrFromSpec();
|
|
68721
|
-
this.
|
|
68722
|
-
this._spec?.chartPadding?.left ?? this._spec.chartPadding ?? 0;
|
|
68723
|
-
this._paddingTop =
|
|
68724
|
-
this._spec?.chartPadding?.top ?? this._spec.chartPadding ?? 0;
|
|
68740
|
+
this._padding = this._option.getChart().padding;
|
|
68725
68741
|
this._nameField = this._spec.nameField;
|
|
68726
68742
|
this._fontFamilyField = this._spec.fontFamilyField;
|
|
68727
68743
|
this._fontWeightField = this._spec.fontWeightField;
|
|
@@ -68883,7 +68899,10 @@
|
|
|
68883
68899
|
wordCloudTransforms.push({
|
|
68884
68900
|
type: 'wordcloud',
|
|
68885
68901
|
layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,
|
|
68886
|
-
size: [
|
|
68902
|
+
size: [
|
|
68903
|
+
srView.width() - this._padding?.left || 0 - this._padding?.right || 0,
|
|
68904
|
+
srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0
|
|
68905
|
+
],
|
|
68887
68906
|
shape: this._maskShape,
|
|
68888
68907
|
dataIndexKey: DEFAULT_DATA_KEY,
|
|
68889
68908
|
text: { field: textField },
|
|
@@ -69040,7 +69059,10 @@
|
|
|
69040
69059
|
wordCloudTransforms.push({
|
|
69041
69060
|
type: 'wordcloud',
|
|
69042
69061
|
layoutType: this._wordCloudConfig.layoutMode,
|
|
69043
|
-
size: [
|
|
69062
|
+
size: [
|
|
69063
|
+
srView.width() - this._padding?.left || 0 - this._padding?.right || 0,
|
|
69064
|
+
srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0
|
|
69065
|
+
],
|
|
69044
69066
|
shape: this._maskShape,
|
|
69045
69067
|
postProjection: this._spec.postProjection ?? 'StereographicProjection',
|
|
69046
69068
|
dataIndexKey: DEFAULT_DATA_KEY,
|
|
@@ -69168,8 +69190,8 @@
|
|
|
69168
69190
|
if (this._wordMark) {
|
|
69169
69191
|
this._wordMark.setAnimationConfig(animationConfig(DEFAULT_MARK_ANIMATION.wordCloud3d(() => {
|
|
69170
69192
|
const srView = this.getCompiler().getVGrammarView();
|
|
69171
|
-
const width = srView.width() - this.
|
|
69172
|
-
const height = srView.height() - this.
|
|
69193
|
+
const width = srView.width() - this._padding?.left || 0 - this._padding?.right || 0;
|
|
69194
|
+
const height = srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0;
|
|
69173
69195
|
const r = Math.max(width, height) / 2;
|
|
69174
69196
|
return {
|
|
69175
69197
|
center: { x: r, y: r, z: this._spec.depth_3d ?? r },
|
|
@@ -69180,8 +69202,8 @@
|
|
|
69180
69202
|
if (this._fillingWordMark) {
|
|
69181
69203
|
this._fillingWordMark.setAnimationConfig(animationConfig(DEFAULT_MARK_ANIMATION.wordCloud3d(() => {
|
|
69182
69204
|
const srView = this.getCompiler().getVGrammarView();
|
|
69183
|
-
const width = srView.width() - this.
|
|
69184
|
-
const height = srView.height() - this.
|
|
69205
|
+
const width = srView.width() - this._padding?.left || 0 - this._padding?.right || 0;
|
|
69206
|
+
const height = srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0;
|
|
69185
69207
|
const r = Math.max(width, height) / 2;
|
|
69186
69208
|
return {
|
|
69187
69209
|
center: { x: r, y: r, z: this._spec.depth_3d ?? r },
|
|
@@ -70887,7 +70909,7 @@
|
|
|
70887
70909
|
_drillInfo;
|
|
70888
70910
|
_getTriggerEvent(type) {
|
|
70889
70911
|
const { mode } = this._drillParams;
|
|
70890
|
-
return defaultTriggerEvent[mode][type];
|
|
70912
|
+
return defaultTriggerEvent[mode]?.[type];
|
|
70891
70913
|
}
|
|
70892
70914
|
_hideTooltip() {
|
|
70893
70915
|
const tooltip = this
|
|
@@ -70913,22 +70935,24 @@
|
|
|
70913
70935
|
bindDrillEvent() {
|
|
70914
70936
|
const { event, getRawData, drillField } = this._drillParams;
|
|
70915
70937
|
const keyField = drillField();
|
|
70916
|
-
|
|
70917
|
-
|
|
70918
|
-
|
|
70919
|
-
|
|
70920
|
-
|
|
70921
|
-
|
|
70922
|
-
|
|
70923
|
-
|
|
70924
|
-
|
|
70925
|
-
|
|
70926
|
-
|
|
70927
|
-
|
|
70928
|
-
|
|
70929
|
-
|
|
70930
|
-
|
|
70931
|
-
|
|
70938
|
+
if (this._getTriggerEvent('start')) {
|
|
70939
|
+
event.on(this._getTriggerEvent('start'), e => {
|
|
70940
|
+
if (isNil(e.datum) || isNil(e.datum?.[keyField])) {
|
|
70941
|
+
this.drillUp();
|
|
70942
|
+
return;
|
|
70943
|
+
}
|
|
70944
|
+
this._hideTooltip();
|
|
70945
|
+
const dataKey = e.datum[keyField];
|
|
70946
|
+
const selectPath = this._drillInfo?.path ?? [];
|
|
70947
|
+
const clickedPath = findHierarchyPath(getRawData().rawData, dataKey, keyField, 'children');
|
|
70948
|
+
if (selectPath[selectPath.length - 1] === clickedPath[clickedPath.length - 1]) {
|
|
70949
|
+
this.drillUp();
|
|
70950
|
+
}
|
|
70951
|
+
else {
|
|
70952
|
+
this.drillDown(clickedPath);
|
|
70953
|
+
}
|
|
70954
|
+
});
|
|
70955
|
+
}
|
|
70932
70956
|
}
|
|
70933
70957
|
drillDown(drillPath = []) {
|
|
70934
70958
|
const { getRawData, event } = this._drillParams;
|
|
@@ -72924,17 +72948,19 @@
|
|
|
72924
72948
|
initZoomable(evt, mode = exports.RenderModeEnum['desktop-browser']) {
|
|
72925
72949
|
this._eventObj = evt;
|
|
72926
72950
|
this._renderMode = mode;
|
|
72927
|
-
this.
|
|
72928
|
-
|
|
72951
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
72952
|
+
this._clickEnable = true;
|
|
72953
|
+
this._zoomableTrigger = new (this._getTriggerEvent('trigger'))();
|
|
72954
|
+
}
|
|
72929
72955
|
}
|
|
72930
|
-
|
|
72956
|
+
_getTriggerEvent(type) {
|
|
72931
72957
|
return defaultTriggerEvent[this._renderMode][type];
|
|
72932
72958
|
}
|
|
72933
72959
|
_bindZoomEventAsRegion(eventObj, regionOrSeries, callback) {
|
|
72934
|
-
eventObj.on(this.
|
|
72960
|
+
eventObj.on(this._getTriggerEvent('scrollEnd'), { level: Event_Bubble_Level.chart, consume: false }, params => {
|
|
72935
72961
|
this._zoomableTrigger.clearZoom();
|
|
72936
72962
|
});
|
|
72937
|
-
eventObj.on(this.
|
|
72963
|
+
eventObj.on(this._getTriggerEvent('scroll'), { level: Event_Bubble_Level.chart, consume: true }, params => {
|
|
72938
72964
|
if (!params.event) {
|
|
72939
72965
|
return;
|
|
72940
72966
|
}
|
|
@@ -72965,44 +72991,52 @@
|
|
|
72965
72991
|
});
|
|
72966
72992
|
}
|
|
72967
72993
|
initZoomEventOfSeries(s, callback) {
|
|
72968
|
-
this.
|
|
72994
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
72995
|
+
this._bindZoomEventAsRegion(s.event, s, callback);
|
|
72996
|
+
}
|
|
72969
72997
|
}
|
|
72970
72998
|
initZoomEventOfRegions(regions, filter, callback) {
|
|
72971
|
-
|
|
72972
|
-
|
|
72973
|
-
|
|
72974
|
-
|
|
72975
|
-
|
|
72976
|
-
|
|
72977
|
-
|
|
72978
|
-
|
|
72979
|
-
|
|
72980
|
-
|
|
72981
|
-
|
|
72982
|
-
|
|
72999
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
73000
|
+
regions.forEach(r => {
|
|
73001
|
+
if (filter) {
|
|
73002
|
+
r.getSeries().forEach(s => {
|
|
73003
|
+
if (filter(s)) {
|
|
73004
|
+
this._bindZoomEventAsRegion(s.event, s, callback);
|
|
73005
|
+
}
|
|
73006
|
+
});
|
|
73007
|
+
}
|
|
73008
|
+
else {
|
|
73009
|
+
this._bindZoomEventAsRegion(this._eventObj, r, callback);
|
|
73010
|
+
}
|
|
73011
|
+
});
|
|
73012
|
+
}
|
|
72983
73013
|
}
|
|
72984
73014
|
initScrollEventOfSeries(s, callback) {
|
|
72985
|
-
this.
|
|
73015
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
73016
|
+
this._bindScrollEventAsRegion(s.event, s, callback);
|
|
73017
|
+
}
|
|
72986
73018
|
}
|
|
72987
73019
|
initScrollEventOfRegions(regions, filter, callback) {
|
|
72988
|
-
|
|
72989
|
-
|
|
72990
|
-
|
|
72991
|
-
|
|
72992
|
-
|
|
72993
|
-
|
|
72994
|
-
|
|
72995
|
-
|
|
72996
|
-
|
|
72997
|
-
|
|
72998
|
-
|
|
72999
|
-
|
|
73020
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
73021
|
+
regions.forEach(r => {
|
|
73022
|
+
if (filter) {
|
|
73023
|
+
r.getSeries().forEach(s => {
|
|
73024
|
+
if (filter(s)) {
|
|
73025
|
+
this._bindScrollEventAsRegion(s.event, s, callback);
|
|
73026
|
+
}
|
|
73027
|
+
});
|
|
73028
|
+
}
|
|
73029
|
+
else {
|
|
73030
|
+
this._bindScrollEventAsRegion(this._eventObj, r, callback);
|
|
73031
|
+
}
|
|
73032
|
+
});
|
|
73033
|
+
}
|
|
73000
73034
|
}
|
|
73001
73035
|
_bindScrollEventAsRegion(eventObj, regionOrSeries, callback) {
|
|
73002
|
-
eventObj.on(this.
|
|
73036
|
+
eventObj.on(this._getTriggerEvent('scrollEnd'), { level: Event_Bubble_Level.chart, consume: false }, params => {
|
|
73003
73037
|
this._zoomableTrigger.clearScroll();
|
|
73004
73038
|
});
|
|
73005
|
-
eventObj.on(this.
|
|
73039
|
+
eventObj.on(this._getTriggerEvent('scroll'), { level: Event_Bubble_Level.chart, consume: true }, params => {
|
|
73006
73040
|
if (!params.event) {
|
|
73007
73041
|
return;
|
|
73008
73042
|
}
|
|
@@ -73033,7 +73067,7 @@
|
|
|
73033
73067
|
});
|
|
73034
73068
|
}
|
|
73035
73069
|
_bindDragEventAsRegion(eventObj, regionOrSeries, callback) {
|
|
73036
|
-
eventObj.on(this.
|
|
73070
|
+
eventObj.on(this._getTriggerEvent('start'), { level: Event_Bubble_Level.chart }, params => {
|
|
73037
73071
|
if (!params.event) {
|
|
73038
73072
|
return;
|
|
73039
73073
|
}
|
|
@@ -73054,36 +73088,40 @@
|
|
|
73054
73088
|
});
|
|
73055
73089
|
}
|
|
73056
73090
|
initDragEventOfSeries(s, callback) {
|
|
73057
|
-
|
|
73058
|
-
this.
|
|
73059
|
-
|
|
73091
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
73092
|
+
s.event.on(this._getTriggerEvent('start'), { level: Event_Bubble_Level.model, filter: ({ model }) => model?.id === s.id }, params => {
|
|
73093
|
+
this._handleDrag(params, callback);
|
|
73094
|
+
});
|
|
73095
|
+
}
|
|
73060
73096
|
}
|
|
73061
73097
|
initDragEventOfRegions(regions, filter, callback) {
|
|
73062
|
-
|
|
73063
|
-
|
|
73064
|
-
|
|
73065
|
-
|
|
73066
|
-
|
|
73067
|
-
this.
|
|
73068
|
-
|
|
73069
|
-
|
|
73070
|
-
|
|
73071
|
-
|
|
73072
|
-
|
|
73073
|
-
|
|
73074
|
-
|
|
73075
|
-
|
|
73076
|
-
|
|
73077
|
-
|
|
73078
|
-
|
|
73098
|
+
if (defaultTriggerEvent[this._renderMode]) {
|
|
73099
|
+
regions.forEach(r => {
|
|
73100
|
+
if (filter) {
|
|
73101
|
+
r.getSeries().forEach(s => {
|
|
73102
|
+
if (filter(s)) {
|
|
73103
|
+
s.event.on(this._getTriggerEvent('start'), { level: Event_Bubble_Level.model, filter: ({ model }) => model?.id === s.id }, params => {
|
|
73104
|
+
this._handleDrag(params, callback);
|
|
73105
|
+
});
|
|
73106
|
+
s.event.on('click', { level: Event_Bubble_Level.model, filter: ({ model }) => model?.id === s.id }, () => {
|
|
73107
|
+
return !this._clickEnable;
|
|
73108
|
+
});
|
|
73109
|
+
}
|
|
73110
|
+
});
|
|
73111
|
+
}
|
|
73112
|
+
else {
|
|
73113
|
+
this._bindDragEventAsRegion(this._eventObj, r, callback);
|
|
73114
|
+
}
|
|
73115
|
+
});
|
|
73116
|
+
}
|
|
73079
73117
|
}
|
|
73080
73118
|
_handleDrag(params, callback) {
|
|
73081
73119
|
this._clickEnable = true;
|
|
73082
73120
|
if (!this._zoomableTrigger.parserDragEvent(params.event)) {
|
|
73083
73121
|
return;
|
|
73084
73122
|
}
|
|
73085
|
-
const move = this.
|
|
73086
|
-
const end = this.
|
|
73123
|
+
const move = this._getTriggerEvent('move');
|
|
73124
|
+
const end = this._getTriggerEvent('end');
|
|
73087
73125
|
const event = params.event;
|
|
73088
73126
|
let x = event.canvasX;
|
|
73089
73127
|
let y = event.canvasY;
|
|
@@ -75395,8 +75433,7 @@
|
|
|
75395
75433
|
wordCloudConfig: spec.wordCloudConfig,
|
|
75396
75434
|
wordCloudShapeConfig: spec.wordCloudShapeConfig,
|
|
75397
75435
|
word: spec.word,
|
|
75398
|
-
fillingWord: spec.fillingWord
|
|
75399
|
-
chartPadding: spec.padding
|
|
75436
|
+
fillingWord: spec.fillingWord
|
|
75400
75437
|
};
|
|
75401
75438
|
const seriesType = this.seriesType;
|
|
75402
75439
|
if (seriesType) {
|
|
@@ -75435,8 +75472,7 @@
|
|
|
75435
75472
|
wordCloudConfig: spec.wordCloudConfig,
|
|
75436
75473
|
wordCloudShapeConfig: spec.wordCloudShapeConfig,
|
|
75437
75474
|
word: spec.word,
|
|
75438
|
-
fillingWord: spec.fillingWord
|
|
75439
|
-
chartPadding: spec.padding
|
|
75475
|
+
fillingWord: spec.fillingWord
|
|
75440
75476
|
};
|
|
75441
75477
|
const seriesType = this.seriesType;
|
|
75442
75478
|
if (seriesType) {
|
|
@@ -75630,6 +75666,8 @@
|
|
|
75630
75666
|
}
|
|
75631
75667
|
clear() {
|
|
75632
75668
|
this._container = null;
|
|
75669
|
+
this.pluginService?.disposeAll();
|
|
75670
|
+
this.pluginService = null;
|
|
75633
75671
|
}
|
|
75634
75672
|
compile() {
|
|
75635
75673
|
this.compileSignal();
|
|
@@ -75654,7 +75692,7 @@
|
|
|
75654
75692
|
datum: null,
|
|
75655
75693
|
source: Event_Source_Type.chart,
|
|
75656
75694
|
chart: this._option?.globalInstance?.getChart()
|
|
75657
|
-
});
|
|
75695
|
+
}, 'model');
|
|
75658
75696
|
};
|
|
75659
75697
|
}
|
|
75660
75698
|
|
|
@@ -77498,16 +77536,216 @@
|
|
|
77498
77536
|
}
|
|
77499
77537
|
}
|
|
77500
77538
|
|
|
77501
|
-
|
|
77502
|
-
|
|
77503
|
-
}
|
|
77504
|
-
|
|
77505
|
-
|
|
77506
|
-
|
|
77539
|
+
function isValidAlignDomain(domain) {
|
|
77540
|
+
return domain.length === 2 && isValidNumber(domain[0]) && isValidNumber(domain[1]) && domain[1] >= domain[0];
|
|
77541
|
+
}
|
|
77542
|
+
function getScaleInfo(axis, domain) {
|
|
77543
|
+
const total = domain[1] - domain[0];
|
|
77544
|
+
const includeZero = domain[1] * domain[0] < 0;
|
|
77545
|
+
let negative = domain[0] <= 0 ? 0 - domain[0] : 0;
|
|
77546
|
+
let positive = domain[1] > 0 ? domain[1] - 0 : 0;
|
|
77547
|
+
if (total === 0) {
|
|
77548
|
+
if (domain[0] < 0) {
|
|
77549
|
+
negative = 1;
|
|
77550
|
+
positive = 0;
|
|
77551
|
+
}
|
|
77552
|
+
else if (domain[0] > 0) {
|
|
77553
|
+
negative = 0;
|
|
77554
|
+
positive = 1;
|
|
77555
|
+
}
|
|
77556
|
+
}
|
|
77557
|
+
else {
|
|
77558
|
+
negative = negative / total;
|
|
77559
|
+
positive = positive / total;
|
|
77560
|
+
}
|
|
77561
|
+
const domainSpec = axis.getDomainSpec();
|
|
77562
|
+
return {
|
|
77563
|
+
total,
|
|
77564
|
+
negative,
|
|
77565
|
+
positive,
|
|
77566
|
+
includeZero,
|
|
77567
|
+
domain,
|
|
77568
|
+
extendable_min: !isValidNumber(domainSpec.min),
|
|
77569
|
+
extendable_max: !isValidNumber(domainSpec.max)
|
|
77570
|
+
};
|
|
77571
|
+
}
|
|
77572
|
+
function inDifferentCrossZero(info1, info2) {
|
|
77573
|
+
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
77574
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
77575
|
+
if (positive2 > 0) {
|
|
77576
|
+
if (!s2Extendable_min) {
|
|
77577
|
+
return false;
|
|
77578
|
+
}
|
|
77579
|
+
let comp = negative1 / positive1;
|
|
77580
|
+
if (s1Extendable_max) {
|
|
77581
|
+
comp = negative1 / Math.max(positive1, positive2);
|
|
77582
|
+
domain1[1] = -domain1[0] / comp;
|
|
77583
|
+
}
|
|
77584
|
+
domain2[0] = -domain2[1] * comp;
|
|
77585
|
+
}
|
|
77586
|
+
else if (negative2 > 0) {
|
|
77587
|
+
if (!s2Extendable_max) {
|
|
77588
|
+
return false;
|
|
77589
|
+
}
|
|
77590
|
+
let comp = positive1 / negative1;
|
|
77591
|
+
if (s1Extendable_min) {
|
|
77592
|
+
comp = positive1 / Math.max(negative1, negative1);
|
|
77593
|
+
domain1[0] = -domain1[1] / comp;
|
|
77594
|
+
}
|
|
77595
|
+
domain2[1] = -domain2[0] * comp;
|
|
77596
|
+
}
|
|
77597
|
+
return true;
|
|
77598
|
+
}
|
|
77599
|
+
function inOnlyZeroDomain(info1, info2) {
|
|
77600
|
+
const { extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
77601
|
+
const { positive: positive2, negative: negative2, domain: domain2 } = info2;
|
|
77602
|
+
if (positive2 === 0 && negative2 === 0) {
|
|
77603
|
+
return false;
|
|
77604
|
+
}
|
|
77605
|
+
if (positive2 > 0 && !s1Extendable_max) {
|
|
77606
|
+
return false;
|
|
77607
|
+
}
|
|
77608
|
+
if (negative2 > 0 && !s1Extendable_min) {
|
|
77609
|
+
return false;
|
|
77610
|
+
}
|
|
77611
|
+
domain1[0] = domain2[0];
|
|
77612
|
+
domain1[1] = domain2[1];
|
|
77613
|
+
return true;
|
|
77614
|
+
}
|
|
77615
|
+
function inAllCrossZero(info1, info2) {
|
|
77616
|
+
const { positive: positive1, negative: negative1, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
77617
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, domain: domain2 } = info2;
|
|
77618
|
+
if (s1Extendable_max && s2Extendable_min) {
|
|
77619
|
+
const comp = Math.max(negative1, negative2) / Math.max(positive1, positive2);
|
|
77620
|
+
domain1[1] = -domain1[0] / comp;
|
|
77621
|
+
domain2[0] = -domain2[1] * comp;
|
|
77622
|
+
}
|
|
77623
|
+
else if (s2Extendable_min) {
|
|
77624
|
+
const comp = negative1 / positive1;
|
|
77625
|
+
domain2[0] = -domain2[1] * comp;
|
|
77626
|
+
}
|
|
77627
|
+
else if (s1Extendable_max) {
|
|
77628
|
+
const comp = negative2 / positive2;
|
|
77629
|
+
domain1[1] = -domain1[0] / comp;
|
|
77630
|
+
}
|
|
77631
|
+
else {
|
|
77632
|
+
return false;
|
|
77633
|
+
}
|
|
77634
|
+
return true;
|
|
77635
|
+
}
|
|
77636
|
+
function inNoCrossDifferentSide(info1, info2) {
|
|
77637
|
+
const { extendable_min: s1Extendable_min, domain: domain1 } = info1;
|
|
77638
|
+
const { extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
77639
|
+
if (!s1Extendable_min || !s2Extendable_max) {
|
|
77640
|
+
return false;
|
|
77641
|
+
}
|
|
77642
|
+
domain1[0] = -domain1[1];
|
|
77643
|
+
domain2[1] = -domain2[0];
|
|
77644
|
+
return true;
|
|
77645
|
+
}
|
|
77646
|
+
const zeroAlign = (targetAxis, currentAxis) => {
|
|
77647
|
+
const s1 = targetAxis.getScale();
|
|
77648
|
+
const s2 = currentAxis.getScale();
|
|
77649
|
+
if (!s1 || !s2) {
|
|
77650
|
+
return;
|
|
77651
|
+
}
|
|
77652
|
+
if (!isContinuous(s1.type) || !isContinuous(s2.type)) {
|
|
77653
|
+
return;
|
|
77654
|
+
}
|
|
77655
|
+
const domain1 = [...s1.domain()];
|
|
77656
|
+
const domain2 = [...s2.domain()];
|
|
77657
|
+
if (!isValidAlignDomain(domain1) || !isValidAlignDomain(domain2)) {
|
|
77658
|
+
return;
|
|
77659
|
+
}
|
|
77660
|
+
const info1 = getScaleInfo(targetAxis, domain1);
|
|
77661
|
+
const info2 = getScaleInfo(currentAxis, domain2);
|
|
77662
|
+
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, includeZero: includeZero1 } = info1;
|
|
77663
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, includeZero: includeZero2 } = info2;
|
|
77664
|
+
if (positive1 === 0 && negative1 === 0) {
|
|
77665
|
+
if (!inOnlyZeroDomain(info1, info2)) {
|
|
77666
|
+
return;
|
|
77667
|
+
}
|
|
77668
|
+
}
|
|
77669
|
+
else if (positive2 === 0 && negative2 === 0) {
|
|
77670
|
+
if (!inOnlyZeroDomain(info2, info1)) {
|
|
77671
|
+
return;
|
|
77672
|
+
}
|
|
77673
|
+
}
|
|
77674
|
+
else if (!includeZero1 && !includeZero2) {
|
|
77675
|
+
if (negative1 === 0 && positive2 === 0) {
|
|
77676
|
+
if (!inNoCrossDifferentSide(info1, info2)) {
|
|
77677
|
+
return;
|
|
77678
|
+
}
|
|
77679
|
+
}
|
|
77680
|
+
else if (negative2 === 0 && positive1 === 0) {
|
|
77681
|
+
if (!inNoCrossDifferentSide(info2, info1)) {
|
|
77682
|
+
return;
|
|
77683
|
+
}
|
|
77684
|
+
}
|
|
77685
|
+
if (negative1 === 0 && negative2 === 0) {
|
|
77686
|
+
if (domain1[0] === 0 && domain2[0] > 0) {
|
|
77687
|
+
if (!s2Extendable_min) {
|
|
77688
|
+
return;
|
|
77689
|
+
}
|
|
77690
|
+
domain2[0] = 0;
|
|
77691
|
+
}
|
|
77692
|
+
else if (domain2[0] === 0 && domain1[0] > 0) {
|
|
77693
|
+
if (!s1Extendable_min) {
|
|
77694
|
+
return;
|
|
77695
|
+
}
|
|
77696
|
+
domain1[0] = 0;
|
|
77697
|
+
}
|
|
77698
|
+
else {
|
|
77699
|
+
return;
|
|
77700
|
+
}
|
|
77701
|
+
}
|
|
77702
|
+
if (positive1 === 0 && positive2 === 0) {
|
|
77703
|
+
if (domain1[1] === 0 && domain2[1] > 0) {
|
|
77704
|
+
if (!s2Extendable_max) {
|
|
77705
|
+
return;
|
|
77706
|
+
}
|
|
77707
|
+
domain2[1] = 0;
|
|
77708
|
+
}
|
|
77709
|
+
else if (domain2[1] === 0 && domain1[1] > 0) {
|
|
77710
|
+
if (!s1Extendable_max) {
|
|
77711
|
+
return;
|
|
77712
|
+
}
|
|
77713
|
+
domain1[1] = 0;
|
|
77714
|
+
}
|
|
77715
|
+
else {
|
|
77716
|
+
return;
|
|
77717
|
+
}
|
|
77718
|
+
}
|
|
77719
|
+
}
|
|
77720
|
+
else if (includeZero1 && !includeZero2) {
|
|
77721
|
+
if (!inDifferentCrossZero(info1, info2)) {
|
|
77722
|
+
return;
|
|
77723
|
+
}
|
|
77724
|
+
}
|
|
77725
|
+
else if (includeZero2 && !includeZero1) {
|
|
77726
|
+
if (!inDifferentCrossZero(info2, info1)) {
|
|
77727
|
+
return;
|
|
77728
|
+
}
|
|
77729
|
+
}
|
|
77730
|
+
else {
|
|
77731
|
+
if (negative1 === negative2) {
|
|
77732
|
+
return;
|
|
77733
|
+
}
|
|
77734
|
+
else if (negative1 > negative2) {
|
|
77735
|
+
if (!inAllCrossZero(info1, info2)) {
|
|
77736
|
+
return;
|
|
77737
|
+
}
|
|
77738
|
+
}
|
|
77739
|
+
else {
|
|
77740
|
+
if (!inAllCrossZero(info2, info1)) {
|
|
77741
|
+
return;
|
|
77742
|
+
}
|
|
77743
|
+
}
|
|
77744
|
+
}
|
|
77745
|
+
s1.domain(domain1);
|
|
77746
|
+
s2.domain(domain2);
|
|
77507
77747
|
};
|
|
77508
77748
|
|
|
77509
|
-
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
77510
|
-
|
|
77511
77749
|
const convertDomainToTickData = (domain, op) => {
|
|
77512
77750
|
const ticks = domain.map((t, index) => {
|
|
77513
77751
|
return {
|
|
@@ -77639,6 +77877,124 @@
|
|
|
77639
77877
|
return labelBoundsList;
|
|
77640
77878
|
};
|
|
77641
77879
|
|
|
77880
|
+
const tickAlign = (data, op) => {
|
|
77881
|
+
if (!data) {
|
|
77882
|
+
return data;
|
|
77883
|
+
}
|
|
77884
|
+
const targetAxis = op?.targetAxis?.();
|
|
77885
|
+
if (!targetAxis) {
|
|
77886
|
+
return data;
|
|
77887
|
+
}
|
|
77888
|
+
const currentAxis = op?.currentAxis?.();
|
|
77889
|
+
if (!currentAxis) {
|
|
77890
|
+
return data;
|
|
77891
|
+
}
|
|
77892
|
+
const currentData = currentAxis.getTickData()?.getDataView();
|
|
77893
|
+
if (!currentData) {
|
|
77894
|
+
return data;
|
|
77895
|
+
}
|
|
77896
|
+
const currentTickTransform = currentData.transformsArr.find(t => t.type === 'ticks');
|
|
77897
|
+
if (!currentTickTransform) {
|
|
77898
|
+
return data;
|
|
77899
|
+
}
|
|
77900
|
+
const currentScale = currentAxis.getScale();
|
|
77901
|
+
if (!currentScale) {
|
|
77902
|
+
return data;
|
|
77903
|
+
}
|
|
77904
|
+
const targetData = targetAxis.getTickData()?.getDataView()?.latestData;
|
|
77905
|
+
if (!targetData?.length) {
|
|
77906
|
+
return data;
|
|
77907
|
+
}
|
|
77908
|
+
const targetScale = targetAxis.getScale();
|
|
77909
|
+
if (!targetScale) {
|
|
77910
|
+
return data;
|
|
77911
|
+
}
|
|
77912
|
+
const targetDomain = targetScale.domain();
|
|
77913
|
+
const targetRange = targetDomain[1] - targetDomain[0];
|
|
77914
|
+
if (targetRange === 0) {
|
|
77915
|
+
return data;
|
|
77916
|
+
}
|
|
77917
|
+
const currentDomain = currentScale.domain();
|
|
77918
|
+
const currentRange = currentDomain[1] - currentDomain[0];
|
|
77919
|
+
if (targetRange === 0) {
|
|
77920
|
+
return data;
|
|
77921
|
+
}
|
|
77922
|
+
const newTicks = targetData.map((d) => {
|
|
77923
|
+
const percent = (d.value - targetDomain[0]) / targetRange;
|
|
77924
|
+
return currentRange * percent + currentDomain[0];
|
|
77925
|
+
});
|
|
77926
|
+
return convertDomainToTickData(newTicks, currentTickTransform.options);
|
|
77927
|
+
};
|
|
77928
|
+
|
|
77929
|
+
class AxisSyncPlugin extends BasicComponentPlugin {
|
|
77930
|
+
Name = 'AxisSyncPlugin';
|
|
77931
|
+
constructor() {
|
|
77932
|
+
super(AxisSyncPlugin.Name);
|
|
77933
|
+
}
|
|
77934
|
+
_checkEnableSync(axis) {
|
|
77935
|
+
if (!isContinuous(axis.getScale().type)) {
|
|
77936
|
+
return false;
|
|
77937
|
+
}
|
|
77938
|
+
const sync = axis.getSpec().sync;
|
|
77939
|
+
if (!sync?.axisId) {
|
|
77940
|
+
return false;
|
|
77941
|
+
}
|
|
77942
|
+
return sync;
|
|
77943
|
+
}
|
|
77944
|
+
_getTargetAxis(axis, sync) {
|
|
77945
|
+
const targetAxis = axis.getOption().getChart().getComponentByUserId(sync.axisId);
|
|
77946
|
+
if (!targetAxis?.type.startsWith('cartesianAxis')) {
|
|
77947
|
+
return null;
|
|
77948
|
+
}
|
|
77949
|
+
return targetAxis;
|
|
77950
|
+
}
|
|
77951
|
+
onInit(service, axis) {
|
|
77952
|
+
const sync = this._checkEnableSync(axis);
|
|
77953
|
+
if (!sync) {
|
|
77954
|
+
return;
|
|
77955
|
+
}
|
|
77956
|
+
if (!sync.zeroAlign) {
|
|
77957
|
+
return;
|
|
77958
|
+
}
|
|
77959
|
+
const targetAxis = this._getTargetAxis(axis, sync);
|
|
77960
|
+
if (!targetAxis) {
|
|
77961
|
+
return;
|
|
77962
|
+
}
|
|
77963
|
+
axis.event.on(ChartEvent.scaleDomainUpdate, { filter: ({ model }) => model.id === axis.id }, () => {
|
|
77964
|
+
zeroAlign(targetAxis, axis);
|
|
77965
|
+
});
|
|
77966
|
+
}
|
|
77967
|
+
onDidCompile(service, axis) {
|
|
77968
|
+
const sync = this._checkEnableSync(axis);
|
|
77969
|
+
if (!sync) {
|
|
77970
|
+
return;
|
|
77971
|
+
}
|
|
77972
|
+
const targetAxis = this._getTargetAxis(axis, sync);
|
|
77973
|
+
if (!targetAxis) {
|
|
77974
|
+
return;
|
|
77975
|
+
}
|
|
77976
|
+
if (sync.tickAlign) {
|
|
77977
|
+
registerDataSetInstanceTransform(axis.getOption().dataSet, 'tickAlign', tickAlign);
|
|
77978
|
+
const opt = {
|
|
77979
|
+
targetAxis: () => targetAxis,
|
|
77980
|
+
currentAxis: () => axis
|
|
77981
|
+
};
|
|
77982
|
+
axis.addTransformToTickData({ type: 'tickAlign', options: opt, level: Number.MAX_SAFE_INTEGER }, false);
|
|
77983
|
+
}
|
|
77984
|
+
}
|
|
77985
|
+
}
|
|
77986
|
+
|
|
77987
|
+
var pluginMap = {
|
|
77988
|
+
AxisLabelOverlapPlugin,
|
|
77989
|
+
AxisSyncPlugin
|
|
77990
|
+
};
|
|
77991
|
+
|
|
77992
|
+
const scaleParser = (scale) => {
|
|
77993
|
+
return scale;
|
|
77994
|
+
};
|
|
77995
|
+
|
|
77996
|
+
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
77997
|
+
|
|
77642
77998
|
const continuousTicks = (scale, op) => {
|
|
77643
77999
|
if (!isContinuous(scale.type)) {
|
|
77644
78000
|
return convertDomainToTickData(scale.domain(), op);
|
|
@@ -77890,6 +78246,9 @@
|
|
|
77890
78246
|
return this._scales;
|
|
77891
78247
|
}
|
|
77892
78248
|
_tickData;
|
|
78249
|
+
getTickData() {
|
|
78250
|
+
return this._tickData;
|
|
78251
|
+
}
|
|
77893
78252
|
_statisticsDomain = { domain: [], index: {} };
|
|
77894
78253
|
getStatisticsDomain() {
|
|
77895
78254
|
return this._statisticsDomain;
|
|
@@ -78027,6 +78386,7 @@
|
|
|
78027
78386
|
this._scales[i].domain(domain);
|
|
78028
78387
|
}
|
|
78029
78388
|
this.transformScaleDomain();
|
|
78389
|
+
this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
|
|
78030
78390
|
this.event.emit(ChartEvent.scaleUpdate, { model: this });
|
|
78031
78391
|
}
|
|
78032
78392
|
computeData() {
|
|
@@ -78193,9 +78553,12 @@
|
|
|
78193
78553
|
}
|
|
78194
78554
|
};
|
|
78195
78555
|
}
|
|
78556
|
+
addTransformToTickData(options, execute) {
|
|
78557
|
+
this._tickData?.getDataView()?.transform(options, execute);
|
|
78558
|
+
}
|
|
78196
78559
|
}
|
|
78197
78560
|
|
|
78198
|
-
const CartesianAxisPlugin = [pluginMap.AxisLabelOverlapPlugin];
|
|
78561
|
+
const CartesianAxisPlugin = [pluginMap.AxisLabelOverlapPlugin, pluginMap.AxisSyncPlugin];
|
|
78199
78562
|
class CartesianAxis extends AxisComponent {
|
|
78200
78563
|
static type = ComponentTypeEnum.cartesianAxis;
|
|
78201
78564
|
type = ComponentTypeEnum.cartesianAxis;
|
|
@@ -78350,6 +78713,9 @@
|
|
|
78350
78713
|
init(option) {
|
|
78351
78714
|
super.init(option);
|
|
78352
78715
|
this.pluginService?.load(CartesianAxisPlugin.map(P => new P()));
|
|
78716
|
+
this.callPlugin(plugin => {
|
|
78717
|
+
this.pluginService && plugin.onInit && plugin.onInit(this.pluginService, this);
|
|
78718
|
+
});
|
|
78353
78719
|
}
|
|
78354
78720
|
setAttrFromSpec() {
|
|
78355
78721
|
super.setAttrFromSpec();
|
|
@@ -78414,7 +78780,7 @@
|
|
|
78414
78780
|
getAxisId: () => this.id
|
|
78415
78781
|
};
|
|
78416
78782
|
}
|
|
78417
|
-
|
|
78783
|
+
afterCompile() {
|
|
78418
78784
|
const product = this.getMarks()[0]?.getProduct();
|
|
78419
78785
|
if (product) {
|
|
78420
78786
|
product.addEventListener(HOOK_EVENT.AFTER_ELEMENT_ENCODE, () => {
|
|
@@ -78435,6 +78801,9 @@
|
|
|
78435
78801
|
}
|
|
78436
78802
|
});
|
|
78437
78803
|
}
|
|
78804
|
+
this.callPlugin(plugin => {
|
|
78805
|
+
this.pluginService && plugin.onDidCompile && plugin.onDidCompile(this.pluginService, this);
|
|
78806
|
+
});
|
|
78438
78807
|
}
|
|
78439
78808
|
onLayoutEnd(ctx) {
|
|
78440
78809
|
const isRangeChange = this.updateScaleRange();
|
|
@@ -78899,6 +79268,9 @@
|
|
|
78899
79268
|
temp < domain[min] && (domain[min] = temp);
|
|
78900
79269
|
}
|
|
78901
79270
|
}
|
|
79271
|
+
getDomainSpec() {
|
|
79272
|
+
return this._domain;
|
|
79273
|
+
}
|
|
78902
79274
|
setDomainMinMax(domain) {
|
|
78903
79275
|
if (!this._domain) {
|
|
78904
79276
|
return;
|
|
@@ -78930,6 +79302,7 @@
|
|
|
78930
79302
|
this.niceDomain(domain);
|
|
78931
79303
|
this._scale.domain(domain, this._nice);
|
|
78932
79304
|
this.niceMinMax();
|
|
79305
|
+
this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
|
|
78933
79306
|
this.event.emit(ChartEvent.scaleUpdate, { model: this });
|
|
78934
79307
|
}
|
|
78935
79308
|
}
|
|
@@ -81090,12 +81463,14 @@
|
|
|
81090
81463
|
return result;
|
|
81091
81464
|
}
|
|
81092
81465
|
_initEvent() {
|
|
81093
|
-
|
|
81094
|
-
|
|
81095
|
-
|
|
81096
|
-
|
|
81097
|
-
|
|
81098
|
-
|
|
81466
|
+
if (this._getTriggerEvent()) {
|
|
81467
|
+
const { in: triggerEvent, out: outTriggerEvent } = this._getTriggerEvent();
|
|
81468
|
+
if (isArray(triggerEvent)) {
|
|
81469
|
+
triggerEvent.forEach((eventName, index) => this._registerEvent(eventName, isArray(outTriggerEvent) ? outTriggerEvent[index] : outTriggerEvent));
|
|
81470
|
+
}
|
|
81471
|
+
else {
|
|
81472
|
+
this._registerEvent(triggerEvent, outTriggerEvent);
|
|
81473
|
+
}
|
|
81099
81474
|
}
|
|
81100
81475
|
}
|
|
81101
81476
|
_registerEvent(inEventName, outEventName) {
|
|
@@ -81123,24 +81498,27 @@
|
|
|
81123
81498
|
}, 10);
|
|
81124
81499
|
_getTriggerEvent() {
|
|
81125
81500
|
const { mode = exports.RenderModeEnum['desktop-browser'] } = this._option;
|
|
81126
|
-
|
|
81127
|
-
|
|
81128
|
-
|
|
81129
|
-
|
|
81130
|
-
|
|
81131
|
-
|
|
81132
|
-
|
|
81133
|
-
|
|
81134
|
-
|
|
81501
|
+
if (defaultCrosshairTriggerEvent[mode]) {
|
|
81502
|
+
const trigger = this.trigger || 'hover';
|
|
81503
|
+
const outTrigger = (trigger) => (trigger === 'click' ? 'clickOut' : 'hoverOut');
|
|
81504
|
+
if (isArray(trigger)) {
|
|
81505
|
+
let inResult = [];
|
|
81506
|
+
let outResult = [];
|
|
81507
|
+
trigger.forEach(item => {
|
|
81508
|
+
inResult = inResult.concat(defaultCrosshairTriggerEvent[mode][item]);
|
|
81509
|
+
outResult = outResult.concat(defaultCrosshairTriggerEvent[mode][outTrigger(item)]);
|
|
81510
|
+
});
|
|
81511
|
+
return {
|
|
81512
|
+
in: inResult,
|
|
81513
|
+
out: outResult
|
|
81514
|
+
};
|
|
81515
|
+
}
|
|
81135
81516
|
return {
|
|
81136
|
-
in:
|
|
81137
|
-
out:
|
|
81517
|
+
in: defaultCrosshairTriggerEvent[mode][trigger],
|
|
81518
|
+
out: defaultCrosshairTriggerEvent[mode][outTrigger(trigger)]
|
|
81138
81519
|
};
|
|
81139
81520
|
}
|
|
81140
|
-
return
|
|
81141
|
-
in: defaultCrosshairTriggerEvent[mode][trigger],
|
|
81142
|
-
out: defaultCrosshairTriggerEvent[mode][outTrigger(trigger)]
|
|
81143
|
-
};
|
|
81521
|
+
return null;
|
|
81144
81522
|
}
|
|
81145
81523
|
_getAxisInfoByField(field) {
|
|
81146
81524
|
const axesComponents = this._option.getComponentsByKey('axes');
|
|
@@ -81192,18 +81570,20 @@
|
|
|
81192
81570
|
onRender(ctx) {
|
|
81193
81571
|
}
|
|
81194
81572
|
_releaseEvent() {
|
|
81195
|
-
|
|
81196
|
-
|
|
81197
|
-
|
|
81198
|
-
|
|
81199
|
-
|
|
81200
|
-
|
|
81201
|
-
|
|
81202
|
-
|
|
81203
|
-
|
|
81204
|
-
|
|
81205
|
-
|
|
81206
|
-
|
|
81573
|
+
if (this._getTriggerEvent()) {
|
|
81574
|
+
const { in: triggerEvent, out: outTriggerEvent } = this._getTriggerEvent();
|
|
81575
|
+
if (isArray(triggerEvent)) {
|
|
81576
|
+
triggerEvent.forEach(eachTriggerEvent => this._eventOff(eachTriggerEvent));
|
|
81577
|
+
}
|
|
81578
|
+
else {
|
|
81579
|
+
this._eventOff(triggerEvent);
|
|
81580
|
+
}
|
|
81581
|
+
if (isArray(outTriggerEvent)) {
|
|
81582
|
+
outTriggerEvent.forEach(eachTriggerEvent => this._eventOff(eachTriggerEvent));
|
|
81583
|
+
}
|
|
81584
|
+
else {
|
|
81585
|
+
this._eventOff(outTriggerEvent);
|
|
81586
|
+
}
|
|
81207
81587
|
}
|
|
81208
81588
|
}
|
|
81209
81589
|
_firstSeries() {
|
|
@@ -82857,6 +83237,7 @@
|
|
|
82857
83237
|
if (markerVisible) {
|
|
82858
83238
|
if (!this._markerComponent) {
|
|
82859
83239
|
this._createMarkerComponent();
|
|
83240
|
+
this._markerComponent.on('*', (event, type) => this._delegateEvent(this._markerComponent, event, type));
|
|
82860
83241
|
}
|
|
82861
83242
|
this._bindSeries();
|
|
82862
83243
|
this._initDataView();
|