@visactor/vchart 2.0.8-alpha.5 → 2.0.9
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 +908 -583
- package/build/index.js +908 -583
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/config.d.ts +1 -0
- package/cjs/animation/config.js +13 -1
- package/cjs/animation/config.js.map +1 -1
- package/cjs/chart/base/base-chart.d.ts +0 -2
- package/cjs/chart/base/base-chart.js +2 -16
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +0 -2
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/compile/compiler.d.ts +5 -0
- package/cjs/compile/compiler.js +42 -4
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +2 -0
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +1 -1
- package/cjs/component/axis/base-axis.js +1 -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.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.d.ts +1 -1
- package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
- package/cjs/component/axis/interface/common.d.ts +1 -0
- package/cjs/component/axis/interface/common.js.map +1 -1
- package/cjs/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/cjs/component/axis/mixin/band-axis-mixin.js +10 -4
- package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js +15 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/cjs/component/axis/polar/axis.d.ts +1 -1
- package/cjs/component/axis/polar/axis.js.map +1 -1
- package/cjs/component/axis/polar/band-axis.d.ts +1 -1
- package/cjs/component/axis/polar/band-axis.js.map +1 -1
- package/cjs/component/brush/brush.js +6 -5
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +31 -52
- package/cjs/component/data-zoom/data-filter-base-component.js +164 -240
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-event.d.ts +53 -0
- package/cjs/component/data-zoom/data-filter-event.js +112 -0
- package/cjs/component/data-zoom/data-filter-event.js.map +1 -0
- package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
- package/cjs/component/data-zoom/data-zoom/data-zoom.js +129 -84
- package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +35 -36
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/cjs/component/data-zoom/util.d.ts +14 -0
- package/cjs/component/data-zoom/util.js +81 -7
- package/cjs/component/data-zoom/util.js.map +1 -1
- package/cjs/constant/event.d.ts +1 -0
- package/cjs/constant/event.js +8 -8
- 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/core/vchart.d.ts +0 -2
- package/cjs/core/vchart.js +0 -4
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +2 -1
- package/cjs/mark/base/base-mark.js +7 -3
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/interface/common.d.ts +1 -0
- package/cjs/mark/interface/common.js.map +1 -1
- package/cjs/plugin/other.js +2 -1
- package/cjs/plugin/other.js.map +1 -1
- package/cjs/series/bar/bar.js +1 -1
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +1 -0
- package/cjs/series/base/base-series.js +7 -2
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/dot/dot.js +6 -2
- package/cjs/series/dot/dot.js.map +1 -1
- package/cjs/series/util/stack.js +1 -1
- package/cjs/series/util/stack.js.map +1 -1
- package/cjs/typings/spec/common.js.map +1 -1
- package/esm/animation/config.d.ts +1 -0
- package/esm/animation/config.js +8 -1
- package/esm/animation/config.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +0 -2
- package/esm/chart/base/base-chart.js +2 -15
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +0 -2
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/compile/compiler.d.ts +5 -0
- package/esm/compile/compiler.js +44 -4
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +2 -0
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +1 -1
- package/esm/component/axis/base-axis.js +1 -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.map +1 -1
- package/esm/component/axis/cartesian/band-axis.d.ts +1 -1
- package/esm/component/axis/cartesian/band-axis.js.map +1 -1
- package/esm/component/axis/interface/common.d.ts +1 -0
- package/esm/component/axis/interface/common.js.map +1 -1
- package/esm/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/esm/component/axis/mixin/band-axis-mixin.js +10 -4
- package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/esm/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js +15 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/esm/component/axis/polar/axis.d.ts +1 -1
- package/esm/component/axis/polar/axis.js.map +1 -1
- package/esm/component/axis/polar/band-axis.d.ts +1 -1
- package/esm/component/axis/polar/band-axis.js.map +1 -1
- package/esm/component/brush/brush.js +6 -4
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +31 -52
- package/esm/component/data-zoom/data-filter-base-component.js +155 -232
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/data-filter-event.d.ts +53 -0
- package/esm/component/data-zoom/data-filter-event.js +108 -0
- package/esm/component/data-zoom/data-filter-event.js.map +1 -0
- package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
- package/esm/component/data-zoom/data-zoom/data-zoom.js +125 -82
- package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js +36 -36
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/esm/component/data-zoom/util.d.ts +14 -0
- package/esm/component/data-zoom/util.js +63 -7
- package/esm/component/data-zoom/util.js.map +1 -1
- package/esm/constant/event.d.ts +1 -0
- package/esm/constant/event.js +8 -8
- 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/core/vchart.d.ts +0 -2
- package/esm/core/vchart.js +0 -4
- package/esm/core/vchart.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +2 -1
- package/esm/mark/base/base-mark.js +7 -3
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/interface/common.d.ts +1 -0
- package/esm/mark/interface/common.js.map +1 -1
- package/esm/plugin/other.js +2 -2
- package/esm/plugin/other.js.map +1 -1
- package/esm/series/bar/bar.js +2 -2
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +1 -0
- package/esm/series/base/base-series.js +6 -2
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/dot/dot.js +6 -2
- package/esm/series/dot/dot.js.map +1 -1
- package/esm/series/util/stack.js +2 -2
- package/esm/series/util/stack.js.map +1 -1
- package/esm/typings/spec/common.js.map +1 -1
- package/package.json +8 -8
package/build/index.es.js
CHANGED
|
@@ -43196,7 +43196,16 @@ class LabelBase extends AnimateComponent {
|
|
|
43196
43196
|
data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
|
|
43197
43197
|
}
|
|
43198
43198
|
let labels = this._initText(data);
|
|
43199
|
-
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels)
|
|
43199
|
+
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
|
|
43200
|
+
const filteredLabels = [],
|
|
43201
|
+
overlapLabels = labels;
|
|
43202
|
+
if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
|
|
43203
|
+
const getRelatedGraphic = this.getRelatedGraphic.bind(this);
|
|
43204
|
+
labels.forEach(label => {
|
|
43205
|
+
overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
|
|
43206
|
+
});
|
|
43207
|
+
}
|
|
43208
|
+
isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(overlapLabels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this).concat(filteredLabels) : !1 !== overlap && (labels = this._overlapping(overlapLabels).concat(filteredLabels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this), labels && labels.length && labels.forEach(label => {
|
|
43200
43209
|
this._bindEvent(label), this._setStatesOfText(label);
|
|
43201
43210
|
}), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), !1 !== this._enableAnimation && this._baseMarks.forEach((mark, index) => {
|
|
43202
43211
|
mark.initAttributes(markAttributeList[index]);
|
|
@@ -45465,15 +45474,18 @@ class DataZoomRenderer {
|
|
|
45465
45474
|
pickable: !1
|
|
45466
45475
|
}, selectedBackgroundChartStyle.area));
|
|
45467
45476
|
}
|
|
45468
|
-
_computeBasePoints() {
|
|
45477
|
+
_computeBasePoints(points) {
|
|
45469
45478
|
const {
|
|
45470
45479
|
orient: orient
|
|
45471
45480
|
} = this.attribute,
|
|
45472
|
-
|
|
45473
|
-
|
|
45474
|
-
|
|
45475
|
-
|
|
45476
|
-
|
|
45481
|
+
key = "bottom" === orient || "top" === orient ? "x" : "y";
|
|
45482
|
+
let lastPointSide = Math.sign(points[points.length - 1][key] - points[0][key]);
|
|
45483
|
+
0 === lastPointSide && (lastPointSide = 1);
|
|
45484
|
+
const {
|
|
45485
|
+
position: position,
|
|
45486
|
+
width: width,
|
|
45487
|
+
height: height
|
|
45488
|
+
} = this._getLayoutAttrFromConfig();
|
|
45477
45489
|
let basePointStart, basePointEnd;
|
|
45478
45490
|
return this._isHorizontal ? (basePointStart = [{
|
|
45479
45491
|
x: position.x,
|
|
@@ -45493,7 +45505,10 @@ class DataZoomRenderer {
|
|
|
45493
45505
|
}], basePointEnd = [{
|
|
45494
45506
|
x: position.x,
|
|
45495
45507
|
y: position.y
|
|
45496
|
-
}]), {
|
|
45508
|
+
}]), Math.sign(basePointEnd[0][key] - basePointStart[0][key]) !== lastPointSide ? {
|
|
45509
|
+
basePointStart: basePointEnd,
|
|
45510
|
+
basePointEnd: basePointStart
|
|
45511
|
+
} : {
|
|
45497
45512
|
basePointStart: basePointStart,
|
|
45498
45513
|
basePointEnd: basePointEnd
|
|
45499
45514
|
};
|
|
@@ -45516,7 +45531,7 @@ class DataZoomRenderer {
|
|
|
45516
45531
|
const {
|
|
45517
45532
|
basePointStart: basePointStart,
|
|
45518
45533
|
basePointEnd: basePointEnd
|
|
45519
|
-
} = this._computeBasePoints();
|
|
45534
|
+
} = this._computeBasePoints(previewPoints);
|
|
45520
45535
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
45521
45536
|
}
|
|
45522
45537
|
_getPreviewAreaPoints() {
|
|
@@ -45531,7 +45546,7 @@ class DataZoomRenderer {
|
|
|
45531
45546
|
const {
|
|
45532
45547
|
basePointStart: basePointStart,
|
|
45533
45548
|
basePointEnd: basePointEnd
|
|
45534
|
-
} = this._computeBasePoints();
|
|
45549
|
+
} = this._computeBasePoints(previewPoints);
|
|
45535
45550
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
45536
45551
|
}
|
|
45537
45552
|
renderText() {
|
|
@@ -45944,11 +45959,12 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
|
|
|
45944
45959
|
})));
|
|
45945
45960
|
}
|
|
45946
45961
|
setAttributes(params, forceUpdateTag) {
|
|
45962
|
+
var _a, _b;
|
|
45947
45963
|
const {
|
|
45948
45964
|
start: start,
|
|
45949
45965
|
end: end
|
|
45950
45966
|
} = this.attribute;
|
|
45951
|
-
start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
45967
|
+
start && (this._state.start = null !== (_a = params.start) && void 0 !== _a ? _a : start), end && (this._state.end = null !== (_b = params.end) && void 0 !== _b ? _b : end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
45952
45968
|
}
|
|
45953
45969
|
render() {
|
|
45954
45970
|
this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"), this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
|
|
@@ -53702,6 +53718,7 @@ var ChartEvent;
|
|
|
53702
53718
|
ChartEvent["markDeltaYUpdate"] = "markDeltaYUpdate";
|
|
53703
53719
|
ChartEvent["viewDataLabelUpdate"] = "viewDataLabelUpdate";
|
|
53704
53720
|
ChartEvent["scaleDomainUpdate"] = "scaleDomainUpdate";
|
|
53721
|
+
ChartEvent["scaleRawDomainUpdate"] = "scaleRawDomainUpdate";
|
|
53705
53722
|
ChartEvent["scaleUpdate"] = "scaleUpdate";
|
|
53706
53723
|
ChartEvent["dataZoomChange"] = "dataZoomChange";
|
|
53707
53724
|
ChartEvent["drill"] = "drill";
|
|
@@ -54723,6 +54740,7 @@ class Compiler {
|
|
|
54723
54740
|
var _a, _b, _c, _d, _e, _f;
|
|
54724
54741
|
(_b = (_a = this._option.performanceHook) === null || _a === void 0 ? void 0 : _a.beforeDoRender) === null || _b === void 0 ? void 0 : _b.call(_a, this._compileChart.getOption().globalInstance);
|
|
54725
54742
|
if (this._stage) {
|
|
54743
|
+
this.runStageAnimation();
|
|
54726
54744
|
this._rootMarks.forEach(g => {
|
|
54727
54745
|
traverseGroupMark(g, m => {
|
|
54728
54746
|
if (m.needClear) {
|
|
@@ -54765,6 +54783,7 @@ class Compiler {
|
|
|
54765
54783
|
this.handleLayoutEnd();
|
|
54766
54784
|
}
|
|
54767
54785
|
this.findProgressiveMarks();
|
|
54786
|
+
this.updateStateAnimation();
|
|
54768
54787
|
this._doRender(true);
|
|
54769
54788
|
this.doPreProgressive();
|
|
54770
54789
|
log(`--- start of renderMarks(${this._count}) ---`);
|
|
@@ -54810,6 +54829,67 @@ class Compiler {
|
|
|
54810
54829
|
this.renderMarks();
|
|
54811
54830
|
}
|
|
54812
54831
|
}
|
|
54832
|
+
setStageAnimationConfig(config) {
|
|
54833
|
+
const animationConfig = {};
|
|
54834
|
+
Object.keys(config).forEach(key => {
|
|
54835
|
+
const value = config[key];
|
|
54836
|
+
if (isArray$1(value)) {
|
|
54837
|
+
animationConfig[key] = value.map(item => {
|
|
54838
|
+
var _a;
|
|
54839
|
+
const options = (_a = item.options) !== null && _a !== void 0 ? _a : {};
|
|
54840
|
+
return Object.assign(Object.assign({}, item), { options: (...args) => {
|
|
54841
|
+
const _options = typeof options === 'function' ? options(...args) : options;
|
|
54842
|
+
return Object.assign({}, _options);
|
|
54843
|
+
} });
|
|
54844
|
+
});
|
|
54845
|
+
}
|
|
54846
|
+
else {
|
|
54847
|
+
animationConfig[key] = Object.assign({}, config[key]);
|
|
54848
|
+
}
|
|
54849
|
+
});
|
|
54850
|
+
this._stateAnimationConfig = animationConfig;
|
|
54851
|
+
}
|
|
54852
|
+
updateStateAnimation() {
|
|
54853
|
+
const allMarks = [];
|
|
54854
|
+
this._rootMarks.forEach(mark => {
|
|
54855
|
+
traverseGroupMark(mark, m => {
|
|
54856
|
+
allMarks.push(m);
|
|
54857
|
+
});
|
|
54858
|
+
});
|
|
54859
|
+
const markAnimationStates = allMarks.map(mark => mark.getAnimationState());
|
|
54860
|
+
const animationState = markAnimationStates.every(state => state === AnimationStateEnum.appear)
|
|
54861
|
+
? AnimationStateEnum.appear
|
|
54862
|
+
: markAnimationStates.every(state => state === AnimationStateEnum.disappear)
|
|
54863
|
+
? AnimationStateEnum.disappear
|
|
54864
|
+
: AnimationStateEnum.none;
|
|
54865
|
+
if (!this._stage.context) {
|
|
54866
|
+
this._stage.context = {};
|
|
54867
|
+
}
|
|
54868
|
+
this._stage.context.animationState = animationState;
|
|
54869
|
+
}
|
|
54870
|
+
runStageAnimation() {
|
|
54871
|
+
var _a;
|
|
54872
|
+
const animationState = (_a = this._stage.context) === null || _a === void 0 ? void 0 : _a.animationState;
|
|
54873
|
+
if (!this._stateAnimationConfig || animationState === AnimationStateEnum.none) {
|
|
54874
|
+
return;
|
|
54875
|
+
}
|
|
54876
|
+
const animationConfigs = array(this._stateAnimationConfig[animationState]).filter(config => config.type);
|
|
54877
|
+
if (!animationConfigs.length) {
|
|
54878
|
+
return;
|
|
54879
|
+
}
|
|
54880
|
+
if (animationState === AnimationStateEnum.appear) {
|
|
54881
|
+
this._stage.stopAnimationState(AnimationStateEnum.disappear);
|
|
54882
|
+
}
|
|
54883
|
+
else if (animationState === AnimationStateEnum.disappear) {
|
|
54884
|
+
this._stage.stopAnimationState(AnimationStateEnum.appear);
|
|
54885
|
+
}
|
|
54886
|
+
this._stage.applyAnimationState([animationState], [
|
|
54887
|
+
{
|
|
54888
|
+
name: animationState,
|
|
54889
|
+
animation: animationConfigs
|
|
54890
|
+
}
|
|
54891
|
+
]);
|
|
54892
|
+
}
|
|
54813
54893
|
updateViewBox(viewBox, reRender = true) {
|
|
54814
54894
|
if (!this._stage) {
|
|
54815
54895
|
return;
|
|
@@ -58279,6 +58359,15 @@ class BaseMark extends GrammarItem {
|
|
|
58279
58359
|
: () => 'key';
|
|
58280
58360
|
this._dataByGroup = groupData(data, this._groupKeyGetter);
|
|
58281
58361
|
}
|
|
58362
|
+
getAnimationState() {
|
|
58363
|
+
const graphicsAnimationStates = this._graphics.map(g => g.context.animationState);
|
|
58364
|
+
const animationState = graphicsAnimationStates.every(state => state === AnimationStateEnum.appear)
|
|
58365
|
+
? AnimationStateEnum.appear
|
|
58366
|
+
: graphicsAnimationStates.every(state => state === AnimationStateEnum.disappear)
|
|
58367
|
+
? AnimationStateEnum.disappear
|
|
58368
|
+
: graphicsAnimationStates[0];
|
|
58369
|
+
return animationState !== null && animationState !== void 0 ? animationState : AnimationStateEnum.none;
|
|
58370
|
+
}
|
|
58282
58371
|
createAnimationStateList(type, animationConfig) {
|
|
58283
58372
|
var _a;
|
|
58284
58373
|
let config = animationConfig[type];
|
|
@@ -58533,14 +58622,14 @@ class BaseMark extends GrammarItem {
|
|
|
58533
58622
|
_runApplyGraphic(graphics) {
|
|
58534
58623
|
const hasAnimation = this.hasAnimation();
|
|
58535
58624
|
graphics.forEach((g, index) => {
|
|
58536
|
-
var _a;
|
|
58625
|
+
var _a, _b;
|
|
58537
58626
|
const finalAttrs = g.context.finalAttrs;
|
|
58538
58627
|
const hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
58539
58628
|
if (!g.setAttributes) {
|
|
58540
58629
|
const mockGraphic = g;
|
|
58541
58630
|
g = this._createGraphic(finalAttrs);
|
|
58542
58631
|
if (hasAnimation) {
|
|
58543
|
-
g.setFinalAttributes(finalAttrs);
|
|
58632
|
+
(_a = g.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(g, finalAttrs);
|
|
58544
58633
|
}
|
|
58545
58634
|
g.context = mockGraphic.context;
|
|
58546
58635
|
g.context.diffAttrs = finalAttrs;
|
|
@@ -58548,7 +58637,7 @@ class BaseMark extends GrammarItem {
|
|
|
58548
58637
|
if (gIndex >= 0) {
|
|
58549
58638
|
this._graphics[gIndex] = g;
|
|
58550
58639
|
}
|
|
58551
|
-
if ((
|
|
58640
|
+
if ((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) {
|
|
58552
58641
|
const groupIndex = this._dataByGroup ? this._dataByGroup.keys.indexOf(g.context.groupKey) : 0;
|
|
58553
58642
|
const group = groupIndex >= 0 ? this._product.getChildAt(groupIndex) : null;
|
|
58554
58643
|
if (group) {
|
|
@@ -59402,10 +59491,20 @@ const registerLineOrAreaAnimation = () => {
|
|
|
59402
59491
|
const registerPolygonAnimation = () => {
|
|
59403
59492
|
AnimateExecutor.registerBuiltInAnimate('growPointsOut', GrowPointsOut);
|
|
59404
59493
|
};
|
|
59494
|
+
const registerStageAnimation = () => {
|
|
59495
|
+
AnimateExecutor.registerBuiltInAnimate('distortion', Distortion);
|
|
59496
|
+
AnimateExecutor.registerBuiltInAnimate('particle', Particle);
|
|
59497
|
+
AnimateExecutor.registerBuiltInAnimate('pixelation', Pixelation);
|
|
59498
|
+
AnimateExecutor.registerBuiltInAnimate('gaussianBlur', GaussianBlur);
|
|
59499
|
+
AnimateExecutor.registerBuiltInAnimate('glitch', Glitch);
|
|
59500
|
+
AnimateExecutor.registerBuiltInAnimate('grayscale', Grayscale);
|
|
59501
|
+
AnimateExecutor.registerBuiltInAnimate('dissolve', Dissolve);
|
|
59502
|
+
};
|
|
59405
59503
|
|
|
59406
59504
|
const registerAnimate = () => {
|
|
59407
59505
|
registerAnimate$1();
|
|
59408
59506
|
registerBuiltInAnimation();
|
|
59507
|
+
registerStageAnimation();
|
|
59409
59508
|
};
|
|
59410
59509
|
const registerDragPlugin = () => {
|
|
59411
59510
|
Factory.registerStageEventPlugin('drag', DragNDrop);
|
|
@@ -60981,10 +61080,6 @@ class VChart {
|
|
|
60981
61080
|
var _a;
|
|
60982
61081
|
return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
|
|
60983
61082
|
}
|
|
60984
|
-
showCrosshair(cb) {
|
|
60985
|
-
var _a;
|
|
60986
|
-
(_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
|
|
60987
|
-
}
|
|
60988
61083
|
stopAnimation() {
|
|
60989
61084
|
var _a;
|
|
60990
61085
|
(_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
|
|
@@ -61294,7 +61389,7 @@ const lookup = (data, opt) => {
|
|
|
61294
61389
|
});
|
|
61295
61390
|
};
|
|
61296
61391
|
|
|
61297
|
-
const version = "2.0.
|
|
61392
|
+
const version = "2.0.9";
|
|
61298
61393
|
|
|
61299
61394
|
const addVChartProperty = (data, op) => {
|
|
61300
61395
|
const context = op.beforeCall();
|
|
@@ -62344,6 +62439,7 @@ class BaseSeries extends BaseModel {
|
|
|
62344
62439
|
this.initMarkState();
|
|
62345
62440
|
if (hasAnimation) {
|
|
62346
62441
|
this.initAnimation();
|
|
62442
|
+
this.initStageAnimation();
|
|
62347
62443
|
}
|
|
62348
62444
|
this.afterInitMark();
|
|
62349
62445
|
this.initEvent();
|
|
@@ -62800,6 +62896,13 @@ class BaseSeries extends BaseModel {
|
|
|
62800
62896
|
}
|
|
62801
62897
|
initAnimation() {
|
|
62802
62898
|
}
|
|
62899
|
+
initStageAnimation() {
|
|
62900
|
+
const compiler = this._option.getCompiler();
|
|
62901
|
+
if (!(compiler === null || compiler === void 0 ? void 0 : compiler.setStageAnimationConfig)) {
|
|
62902
|
+
return;
|
|
62903
|
+
}
|
|
62904
|
+
compiler.setStageAnimationConfig(animationConfig({}, userAnimationConfig('stage', this._spec, this._markAttributeContext), null));
|
|
62905
|
+
}
|
|
62803
62906
|
initMarkState() {
|
|
62804
62907
|
this.initSeriesStyleState();
|
|
62805
62908
|
}
|
|
@@ -65670,7 +65773,7 @@ class AxisComponent extends BaseComponent {
|
|
|
65670
65773
|
const viewData = s.getViewData();
|
|
65671
65774
|
if (rawData) {
|
|
65672
65775
|
field.forEach(f => {
|
|
65673
|
-
data.push(s.getRawDataStatisticsByField(f,
|
|
65776
|
+
data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
|
|
65674
65777
|
});
|
|
65675
65778
|
}
|
|
65676
65779
|
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
@@ -66933,8 +67036,12 @@ const DEFAULT_TICK_COUNT = 5;
|
|
|
66933
67036
|
class LinearAxisMixin {
|
|
66934
67037
|
constructor() {
|
|
66935
67038
|
this._extend = {};
|
|
67039
|
+
this._rawDomain = [];
|
|
66936
67040
|
this.niceLabelFormatter = null;
|
|
66937
67041
|
}
|
|
67042
|
+
getRawDomain() {
|
|
67043
|
+
return this._rawDomain;
|
|
67044
|
+
}
|
|
66938
67045
|
setExtraAttrFromSpec() {
|
|
66939
67046
|
isValid$1(this._spec.nice) && (this._nice = this._spec.nice);
|
|
66940
67047
|
isValid$1(this._spec.zero) && (this._zero = this._spec.zero);
|
|
@@ -67201,9 +67308,13 @@ class LinearAxisMixin {
|
|
|
67201
67308
|
}
|
|
67202
67309
|
}
|
|
67203
67310
|
updateScaleDomain() {
|
|
67311
|
+
var _a;
|
|
67204
67312
|
if (!this.isSeriesDataEnable()) {
|
|
67205
67313
|
return;
|
|
67206
67314
|
}
|
|
67315
|
+
if (!((_a = this._rawDomain) === null || _a === void 0 ? void 0 : _a.length) && this._scale) {
|
|
67316
|
+
this._updateRawDomain();
|
|
67317
|
+
}
|
|
67207
67318
|
const data = this.collectData();
|
|
67208
67319
|
const domain = this.computeLinearDomain(data);
|
|
67209
67320
|
this.updateScaleDomainByModel(domain);
|
|
@@ -67238,6 +67349,15 @@ class LinearAxisMixin {
|
|
|
67238
67349
|
return value;
|
|
67239
67350
|
};
|
|
67240
67351
|
}
|
|
67352
|
+
_updateRawDomain() {
|
|
67353
|
+
const data = this.collectData(0, true);
|
|
67354
|
+
const domain = this.computeLinearDomain(data);
|
|
67355
|
+
this._rawDomain = domain;
|
|
67356
|
+
this.event.emit(ChartEvent.scaleRawDomainUpdate, { model: this });
|
|
67357
|
+
}
|
|
67358
|
+
_clearRawDomain() {
|
|
67359
|
+
this._rawDomain = [];
|
|
67360
|
+
}
|
|
67241
67361
|
}
|
|
67242
67362
|
|
|
67243
67363
|
const axisLinear = {
|
|
@@ -67469,6 +67589,7 @@ const registerCartesianLinearAxis = () => {
|
|
|
67469
67589
|
class BandAxisMixin {
|
|
67470
67590
|
constructor() {
|
|
67471
67591
|
this._rawDomainIndex = [];
|
|
67592
|
+
this._rawDomain = [];
|
|
67472
67593
|
}
|
|
67473
67594
|
_initData() {
|
|
67474
67595
|
var _a;
|
|
@@ -67520,6 +67641,9 @@ class BandAxisMixin {
|
|
|
67520
67641
|
tickTransform && (tickTransform.options = this._tickTransformOption());
|
|
67521
67642
|
}
|
|
67522
67643
|
}
|
|
67644
|
+
getRawDomain() {
|
|
67645
|
+
return this._rawDomain;
|
|
67646
|
+
}
|
|
67523
67647
|
dataToPosition(values, cfg = {}) {
|
|
67524
67648
|
var _a, _b;
|
|
67525
67649
|
if (values.length === 0 || this._scales.length === 0) {
|
|
@@ -67657,6 +67781,7 @@ class BandAxisMixin {
|
|
|
67657
67781
|
}
|
|
67658
67782
|
_updateRawDomain() {
|
|
67659
67783
|
this._rawDomainIndex = [];
|
|
67784
|
+
this._rawDomain = [];
|
|
67660
67785
|
const userDomain = this._spec.domain;
|
|
67661
67786
|
for (let i = 0; i < this._scales.length; i++) {
|
|
67662
67787
|
if (userDomain && userDomain.length && i === 0) {
|
|
@@ -67666,12 +67791,15 @@ class BandAxisMixin {
|
|
|
67666
67791
|
const data = this.collectData(i, true);
|
|
67667
67792
|
const domain = this.computeBandDomain(data);
|
|
67668
67793
|
this._rawDomainIndex[i] = {};
|
|
67794
|
+
this._rawDomain[i] = domain;
|
|
67669
67795
|
domain.forEach((d, _i) => (this._rawDomainIndex[i][d] = _i));
|
|
67670
67796
|
}
|
|
67671
67797
|
}
|
|
67798
|
+
this.event.emit(ChartEvent.scaleRawDomainUpdate, { model: this });
|
|
67672
67799
|
}
|
|
67673
67800
|
_clearRawDomain() {
|
|
67674
67801
|
this._rawDomainIndex = [];
|
|
67802
|
+
this._rawDomain = [];
|
|
67675
67803
|
}
|
|
67676
67804
|
}
|
|
67677
67805
|
|
|
@@ -70010,12 +70138,10 @@ class BaseChart extends CompilableBase {
|
|
|
70010
70138
|
}
|
|
70011
70139
|
});
|
|
70012
70140
|
const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
|
|
70013
|
-
const isUnableTooltip = isUnableValue ||
|
|
70014
|
-
dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
|
|
70015
70141
|
if (opt.tooltip !== false) {
|
|
70016
70142
|
const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
|
|
70017
70143
|
if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
|
|
70018
|
-
if (isUnableValue
|
|
70144
|
+
if (isUnableValue) {
|
|
70019
70145
|
(_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
70020
70146
|
}
|
|
70021
70147
|
else {
|
|
@@ -70045,25 +70171,6 @@ class BaseChart extends CompilableBase {
|
|
|
70045
70171
|
}
|
|
70046
70172
|
}
|
|
70047
70173
|
}
|
|
70048
|
-
showCrosshair(cb) {
|
|
70049
|
-
var _a;
|
|
70050
|
-
const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
|
|
70051
|
-
if (!crosshair) {
|
|
70052
|
-
return;
|
|
70053
|
-
}
|
|
70054
|
-
const axes = this.getComponentsByKey('axes');
|
|
70055
|
-
const dimInfo = [];
|
|
70056
|
-
axes.forEach(axis => {
|
|
70057
|
-
const value = cb(axis);
|
|
70058
|
-
if (value !== false) {
|
|
70059
|
-
dimInfo.push({
|
|
70060
|
-
axis,
|
|
70061
|
-
value
|
|
70062
|
-
});
|
|
70063
|
-
}
|
|
70064
|
-
});
|
|
70065
|
-
crosshair.showCrosshair(dimInfo);
|
|
70066
|
-
}
|
|
70067
70174
|
getColorScheme() {
|
|
70068
70175
|
var _a, _b;
|
|
70069
70176
|
return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
|
|
@@ -72030,7 +72137,10 @@ function computeOneDatumY(obj, lastY, s, context, seriesScale, isFirst) {
|
|
|
72030
72137
|
lastY = y1;
|
|
72031
72138
|
}
|
|
72032
72139
|
let height = Math.abs(y1 - y);
|
|
72033
|
-
if (height
|
|
72140
|
+
if (height <= 0 && !isValueInScaleDomain(obj[s.getStackValueField()], seriesScale)) {
|
|
72141
|
+
height = 0;
|
|
72142
|
+
}
|
|
72143
|
+
else if (height < barMinHeight) {
|
|
72034
72144
|
height = barMinHeight;
|
|
72035
72145
|
}
|
|
72036
72146
|
let flag = 1;
|
|
@@ -72379,7 +72489,10 @@ class BarSeries extends CartesianSeries {
|
|
|
72379
72489
|
const y1 = valueInScaleRange(this[startMethod](datum), seriesScale, useWholeRange);
|
|
72380
72490
|
const y = valueInScaleRange(this[endMethod](datum), seriesScale, useWholeRange);
|
|
72381
72491
|
let height = Math.abs(y1 - y);
|
|
72382
|
-
if (height
|
|
72492
|
+
if (height <= 0 && !isValueInScaleDomain(datum[this.getStackValueField()], seriesScale)) {
|
|
72493
|
+
height = 0;
|
|
72494
|
+
}
|
|
72495
|
+
else if (height < barMinHeight) {
|
|
72383
72496
|
height = barMinHeight;
|
|
72384
72497
|
}
|
|
72385
72498
|
let flag = 1;
|
|
@@ -79397,13 +79510,14 @@ class DotSeries extends CartesianSeries {
|
|
|
79397
79510
|
});
|
|
79398
79511
|
}
|
|
79399
79512
|
initMarkStyle() {
|
|
79513
|
+
var _a;
|
|
79400
79514
|
const clipMark = this._clipMark;
|
|
79401
79515
|
if (clipMark) {
|
|
79402
79516
|
this.setMarkStyle(clipMark, {
|
|
79403
|
-
x: -this._spec.leftAppendPadding,
|
|
79517
|
+
x: -((_a = this._spec.leftAppendPadding) !== null && _a !== void 0 ? _a : 0),
|
|
79404
79518
|
y: 0,
|
|
79405
79519
|
width: 10000,
|
|
79406
|
-
height: this._spec.clipHeight
|
|
79520
|
+
height: () => { var _a; return (_a = this._spec.clipHeight) !== null && _a !== void 0 ? _a : this._region.getLayoutRect().height; }
|
|
79407
79521
|
}, 'normal', AttributeLevel.Series);
|
|
79408
79522
|
clipMark.setMarkConfig({ interactive: false, clip: true });
|
|
79409
79523
|
}
|
|
@@ -97068,17 +97182,26 @@ const dataFilterWithNewDomain = (data, op) => {
|
|
|
97068
97182
|
return data.filter(filter);
|
|
97069
97183
|
};
|
|
97070
97184
|
const dataFilterComputeDomain = (data, op) => {
|
|
97071
|
-
const { stateFields, valueFields, dataCollection, isCategoryState } = op.input;
|
|
97185
|
+
const { stateFields, valueFields, dataCollection, isCategoryState, seriesCollection } = op.input;
|
|
97072
97186
|
const { stateField, valueField } = op.output;
|
|
97073
97187
|
const resultObj = {};
|
|
97188
|
+
const resultKeys = [];
|
|
97074
97189
|
const resultData = [];
|
|
97075
97190
|
const stateValues = [];
|
|
97076
97191
|
let hasLockDomain = false;
|
|
97192
|
+
let isAllLinearValue = false;
|
|
97077
97193
|
dataCollection.forEach((dv, i) => {
|
|
97078
97194
|
var _a;
|
|
97079
97195
|
if (isNil$1(stateFields[i])) {
|
|
97080
97196
|
return;
|
|
97081
97197
|
}
|
|
97198
|
+
const series = seriesCollection[i];
|
|
97199
|
+
if (series) {
|
|
97200
|
+
const statistics = series.getRawDataStatisticsByField(stateFields[i]);
|
|
97201
|
+
if (isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.max) && isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.min)) {
|
|
97202
|
+
isAllLinearValue = true;
|
|
97203
|
+
}
|
|
97204
|
+
}
|
|
97082
97205
|
const stateFieldInfo = (_a = dv.getFields()) === null || _a === void 0 ? void 0 : _a[stateFields[i]];
|
|
97083
97206
|
if (stateFieldInfo && stateFieldInfo.lockStatisticsByDomain) {
|
|
97084
97207
|
hasLockDomain = true;
|
|
@@ -97086,6 +97209,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97086
97209
|
if (isNil$1(resultObj[d])) {
|
|
97087
97210
|
stateValues.push(d);
|
|
97088
97211
|
resultObj[d] = 0;
|
|
97212
|
+
resultKeys.push(d);
|
|
97089
97213
|
}
|
|
97090
97214
|
});
|
|
97091
97215
|
}
|
|
@@ -97095,6 +97219,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97095
97219
|
if (isNil$1(resultObj[d[state]])) {
|
|
97096
97220
|
stateValues.push(d[state]);
|
|
97097
97221
|
resultObj[d[state]] = 0;
|
|
97222
|
+
resultKeys.push(d[state]);
|
|
97098
97223
|
}
|
|
97099
97224
|
if (!isNil$1(valueFields[i])) {
|
|
97100
97225
|
resultObj[d[state]] += isNaN(parseFloat(d[valueFields[i]])) ? 1 : parseFloat(d[valueFields[i]]);
|
|
@@ -97105,9 +97230,9 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97105
97230
|
});
|
|
97106
97231
|
const sortedStateValues = hasLockDomain
|
|
97107
97232
|
? stateValues
|
|
97108
|
-
: isCategoryState === false
|
|
97233
|
+
: isCategoryState === false || isAllLinearValue
|
|
97109
97234
|
? stateValues.sort((a, b) => a - b)
|
|
97110
|
-
:
|
|
97235
|
+
: resultKeys;
|
|
97111
97236
|
sortedStateValues.forEach(state => {
|
|
97112
97237
|
const res = { [stateField]: state };
|
|
97113
97238
|
if (valueField) {
|
|
@@ -97117,17 +97242,83 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97117
97242
|
});
|
|
97118
97243
|
return resultData;
|
|
97119
97244
|
};
|
|
97120
|
-
|
|
97121
|
-
|
|
97122
|
-
|
|
97123
|
-
|
|
97245
|
+
const statePointToData = (state, scale, reverse) => {
|
|
97246
|
+
const domain = scale.domain();
|
|
97247
|
+
if (isContinuous(scale.type)) {
|
|
97248
|
+
if (reverse) {
|
|
97249
|
+
return domain[0] + (last(domain) - domain[0]) * (1 - state);
|
|
97250
|
+
}
|
|
97251
|
+
return domain[0] + (last(domain) - domain[0]) * state;
|
|
97124
97252
|
}
|
|
97125
|
-
|
|
97126
|
-
|
|
97127
|
-
|
|
97128
|
-
|
|
97129
|
-
|
|
97253
|
+
let range = scale.range();
|
|
97254
|
+
if (reverse) {
|
|
97255
|
+
range = range.slice().reverse();
|
|
97256
|
+
}
|
|
97257
|
+
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
97258
|
+
return scale.invert(posInRange);
|
|
97259
|
+
};
|
|
97260
|
+
const dataToStatePoint = (data, scale, isHorizontal) => {
|
|
97261
|
+
const pos = scale.scale(data);
|
|
97262
|
+
let range = scale.range();
|
|
97263
|
+
if (!isHorizontal && isContinuous(scale.type)) {
|
|
97264
|
+
range = range.slice().reverse();
|
|
97265
|
+
}
|
|
97266
|
+
return Math.max(0, Math.min(1, (pos - range[0]) / (last(range) - range[0])));
|
|
97267
|
+
};
|
|
97268
|
+
const isReverse = (axisComponent, isHorizontal) => {
|
|
97269
|
+
const axis = axisComponent;
|
|
97270
|
+
if (!axis) {
|
|
97271
|
+
return false;
|
|
97272
|
+
}
|
|
97273
|
+
const axisScale = axis.getScale();
|
|
97274
|
+
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || isHorizontal);
|
|
97275
|
+
};
|
|
97276
|
+
const getAxisBandSize = (axisSpec) => {
|
|
97277
|
+
const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
|
|
97278
|
+
const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
|
|
97279
|
+
const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
|
|
97280
|
+
if (bandSize || minBandSize || maxBandSize) {
|
|
97281
|
+
return { bandSize, maxBandSize, minBandSize };
|
|
97130
97282
|
}
|
|
97283
|
+
return undefined;
|
|
97284
|
+
};
|
|
97285
|
+
const modeCheck = (statePoint, mode, spec) => {
|
|
97286
|
+
if (statePoint === 'start') {
|
|
97287
|
+
return (mode === 'percent' && isValid$1(spec.start)) || (mode === 'value' && isValid$1(spec.startValue));
|
|
97288
|
+
}
|
|
97289
|
+
return (mode === 'percent' && isValid$1(spec.end)) || (mode === 'value' && isValid$1(spec.endValue));
|
|
97290
|
+
};
|
|
97291
|
+
const parseDomainFromState = (startValue, endValue, scale) => {
|
|
97292
|
+
if (isContinuous(scale.type)) {
|
|
97293
|
+
return [Math.min(endValue, startValue), Math.max(endValue, startValue)];
|
|
97294
|
+
}
|
|
97295
|
+
const allDomain = scale.domain();
|
|
97296
|
+
const startIndex = allDomain.indexOf(startValue);
|
|
97297
|
+
const endIndex = allDomain.indexOf(endValue);
|
|
97298
|
+
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97299
|
+
};
|
|
97300
|
+
const parseDomainFromStateAndValue = (start, startValue, end, endValue, scale) => {
|
|
97301
|
+
if (isContinuous(scale.type)) {
|
|
97302
|
+
const domain = scale.domain();
|
|
97303
|
+
const min = domain[0];
|
|
97304
|
+
const total = last(domain) - min;
|
|
97305
|
+
const resultStart = isValid$1(start) ? min + total * start : +startValue;
|
|
97306
|
+
const resultEnd = isValid$1(end) ? min + total * end : +endValue;
|
|
97307
|
+
return [Math.min(resultEnd, resultStart), Math.max(resultEnd, resultStart)];
|
|
97308
|
+
}
|
|
97309
|
+
const allDomain = scale.domain();
|
|
97310
|
+
const range = scale.range();
|
|
97311
|
+
const rangeSize = range[range.length - 1] - range[0];
|
|
97312
|
+
const startIndex = isValid$1(start)
|
|
97313
|
+
? allDomain.indexOf(scale.invert(rangeSize * start + range[0]))
|
|
97314
|
+
: allDomain.indexOf(startValue);
|
|
97315
|
+
const endIndex = isValid$1(end)
|
|
97316
|
+
? allDomain.indexOf(scale.invert(rangeSize * end + range[0]))
|
|
97317
|
+
: allDomain.indexOf(endValue);
|
|
97318
|
+
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97319
|
+
};
|
|
97320
|
+
|
|
97321
|
+
class DataFilterEvent {
|
|
97131
97322
|
enableInteraction() {
|
|
97132
97323
|
this._activeRoam = true;
|
|
97133
97324
|
}
|
|
@@ -97135,19 +97326,203 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97135
97326
|
this._activeRoam = false;
|
|
97136
97327
|
}
|
|
97137
97328
|
zoomIn(location) {
|
|
97138
|
-
this.
|
|
97329
|
+
this.handleChartZoom({
|
|
97139
97330
|
zoomDelta: 1.2,
|
|
97140
97331
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97141
97332
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97142
97333
|
});
|
|
97143
97334
|
}
|
|
97144
97335
|
zoomOut(location) {
|
|
97145
|
-
this.
|
|
97336
|
+
this.handleChartZoom({
|
|
97146
97337
|
zoomDelta: 0.8,
|
|
97147
97338
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97148
97339
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97149
97340
|
});
|
|
97150
97341
|
}
|
|
97342
|
+
constructor(type, spec, handleChange, getLayoutRect, getState, getRegions, getOption, getEvent) {
|
|
97343
|
+
this._activeRoam = true;
|
|
97344
|
+
this._zoomAttr = {
|
|
97345
|
+
enable: true,
|
|
97346
|
+
rate: 1,
|
|
97347
|
+
focus: true
|
|
97348
|
+
};
|
|
97349
|
+
this._dragAttr = {
|
|
97350
|
+
enable: true,
|
|
97351
|
+
rate: 1,
|
|
97352
|
+
reverse: true
|
|
97353
|
+
};
|
|
97354
|
+
this._scrollAttr = {
|
|
97355
|
+
enable: true,
|
|
97356
|
+
rate: 1,
|
|
97357
|
+
reverse: true
|
|
97358
|
+
};
|
|
97359
|
+
this.initZoomEvent = () => {
|
|
97360
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
97361
|
+
const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
|
|
97362
|
+
const delayTime = isValid$1((_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayType) ? ((_e = (_d = this._spec) === null || _d === void 0 ? void 0 : _d.delayTime) !== null && _e !== void 0 ? _e : 30) : 0;
|
|
97363
|
+
const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
|
|
97364
|
+
const option = { delayType, delayTime, realTime, allowComponentZoom: true };
|
|
97365
|
+
if (this._zoomAttr.enable) {
|
|
97366
|
+
this.initZoomEventOfRegions(this.getRegions(), null, this.handleChartZoom, option);
|
|
97367
|
+
}
|
|
97368
|
+
if (this._scrollAttr.enable) {
|
|
97369
|
+
this.initScrollEventOfRegions(this.getRegions(), null, this.handleChartScroll, option);
|
|
97370
|
+
}
|
|
97371
|
+
if (this._dragAttr.enable) {
|
|
97372
|
+
this.initDragEventOfRegions(this.getRegions(), null, this.handleChartDrag, option);
|
|
97373
|
+
}
|
|
97374
|
+
};
|
|
97375
|
+
this.handleChartZoom = (params, e) => {
|
|
97376
|
+
var _a, _b;
|
|
97377
|
+
if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
|
|
97378
|
+
return;
|
|
97379
|
+
}
|
|
97380
|
+
const { zoomDelta, zoomX, zoomY } = params;
|
|
97381
|
+
const { x, y } = this.getRegions()[0].getLayoutStartPoint();
|
|
97382
|
+
const { width, height } = this.getRegions()[0].getLayoutRect();
|
|
97383
|
+
const delta = Math.abs(this.getState().start - this.getState().end);
|
|
97384
|
+
const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
|
|
97385
|
+
if (delta >= 1 && zoomDelta < 1) {
|
|
97386
|
+
return;
|
|
97387
|
+
}
|
|
97388
|
+
if (delta <= 0.01 && zoomDelta > 1) {
|
|
97389
|
+
return;
|
|
97390
|
+
}
|
|
97391
|
+
const focusLoc = this._isHorizontal ? zoomX : zoomY;
|
|
97392
|
+
const totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
97393
|
+
let startValue = totalValue / 2;
|
|
97394
|
+
let endValue = totalValue / 2;
|
|
97395
|
+
if (focusLoc) {
|
|
97396
|
+
const startLoc = this._isHorizontal ? x : y;
|
|
97397
|
+
const endLoc = this._isHorizontal ? width : height;
|
|
97398
|
+
startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97399
|
+
endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97400
|
+
}
|
|
97401
|
+
const start = clamp$1(this.getState().start + startValue, 0, 1);
|
|
97402
|
+
const end = clamp$1(this.getState().end - endValue, 0, 1);
|
|
97403
|
+
this._handleChange(Math.min(start, end), Math.max(start, end), true);
|
|
97404
|
+
};
|
|
97405
|
+
this.handleChartScroll = (params, e) => {
|
|
97406
|
+
var _a;
|
|
97407
|
+
if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
|
|
97408
|
+
return false;
|
|
97409
|
+
}
|
|
97410
|
+
const { scrollX, scrollY } = params;
|
|
97411
|
+
let value = this._isHorizontal ? scrollX : scrollY;
|
|
97412
|
+
const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
|
|
97413
|
+
if (!this._scrollAttr.reverse) {
|
|
97414
|
+
value = -value;
|
|
97415
|
+
}
|
|
97416
|
+
if (active) {
|
|
97417
|
+
this.handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97418
|
+
}
|
|
97419
|
+
const hasChange = this.getState().start !== 0 && this.getState().end !== 1;
|
|
97420
|
+
return active && hasChange;
|
|
97421
|
+
};
|
|
97422
|
+
this.handleChartDrag = (delta, e) => {
|
|
97423
|
+
var _a;
|
|
97424
|
+
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
97425
|
+
return;
|
|
97426
|
+
}
|
|
97427
|
+
const [dx, dy] = delta;
|
|
97428
|
+
let value = this._isHorizontal ? dx : dy;
|
|
97429
|
+
if (this._dragAttr.reverse) {
|
|
97430
|
+
value = -value;
|
|
97431
|
+
}
|
|
97432
|
+
this.handleChartMove(value, (_a = this._dragAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97433
|
+
};
|
|
97434
|
+
this.handleChartMove = (value, rate) => {
|
|
97435
|
+
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
97436
|
+
if (Math.abs(value) >= 1e-6) {
|
|
97437
|
+
if (value > 0 && this.getState().end < 1) {
|
|
97438
|
+
const moveDelta = Math.min(1 - this.getState().end, value / totalValue) * rate;
|
|
97439
|
+
this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
|
|
97440
|
+
}
|
|
97441
|
+
else if (value < 0 && this.getState().start > 0) {
|
|
97442
|
+
const moveDelta = Math.max(-this.getState().start, value / totalValue) * rate;
|
|
97443
|
+
this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
|
|
97444
|
+
}
|
|
97445
|
+
}
|
|
97446
|
+
return false;
|
|
97447
|
+
};
|
|
97448
|
+
this._type = type;
|
|
97449
|
+
this._spec = spec;
|
|
97450
|
+
this._handleChange = handleChange;
|
|
97451
|
+
this.getLayoutRect = getLayoutRect;
|
|
97452
|
+
this.getState = getState;
|
|
97453
|
+
this.getRegions = getRegions;
|
|
97454
|
+
this._regions = getRegions();
|
|
97455
|
+
this.getOption = getOption;
|
|
97456
|
+
this._option = getOption();
|
|
97457
|
+
this.getEvent = getEvent;
|
|
97458
|
+
this._isHorizontal = getDirectionByOrient(getOrient(spec)) === "horizontal";
|
|
97459
|
+
}
|
|
97460
|
+
setEventAttrFromSpec() {
|
|
97461
|
+
if (this._spec.roamZoom === true || this._spec.roamZoom) {
|
|
97462
|
+
this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
|
|
97463
|
+
}
|
|
97464
|
+
else {
|
|
97465
|
+
this._zoomAttr.enable = false;
|
|
97466
|
+
}
|
|
97467
|
+
if (this._spec.roamDrag === true || this._spec.roamDrag) {
|
|
97468
|
+
this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
|
|
97469
|
+
}
|
|
97470
|
+
else {
|
|
97471
|
+
this._dragAttr.enable = false;
|
|
97472
|
+
}
|
|
97473
|
+
if (this._spec.roamScroll === true || this._spec.roamScroll) {
|
|
97474
|
+
this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
|
|
97475
|
+
}
|
|
97476
|
+
else {
|
|
97477
|
+
this._scrollAttr.enable = false;
|
|
97478
|
+
}
|
|
97479
|
+
if (isBoolean$1(this._spec.roam)) {
|
|
97480
|
+
this._zoomAttr.enable = this._type === 'scrollBar' ? false : this._spec.roam;
|
|
97481
|
+
this._dragAttr.enable = this._spec.roam;
|
|
97482
|
+
this._scrollAttr.enable = this._spec.roam;
|
|
97483
|
+
}
|
|
97484
|
+
if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
|
|
97485
|
+
this.initZoomable(this.getEvent(), this._option.mode);
|
|
97486
|
+
}
|
|
97487
|
+
}
|
|
97488
|
+
}
|
|
97489
|
+
mixin(DataFilterEvent, Zoomable);
|
|
97490
|
+
|
|
97491
|
+
class DataFilterBaseComponent extends BaseComponent {
|
|
97492
|
+
get isHorizontal() {
|
|
97493
|
+
return this._isHorizontal;
|
|
97494
|
+
}
|
|
97495
|
+
get stateScale() {
|
|
97496
|
+
return this._stateScale;
|
|
97497
|
+
}
|
|
97498
|
+
get relatedAxisComponent() {
|
|
97499
|
+
return this._relatedAxisComponent;
|
|
97500
|
+
}
|
|
97501
|
+
setStartAndEnd(start, end, rangeMode = ['percent', 'percent']) {
|
|
97502
|
+
const [startMode = 'percent', endMode = 'percent'] = rangeMode;
|
|
97503
|
+
const startPercent = (startMode === 'percent' ? start : dataToStatePoint(start, this._stateScale, this._isHorizontal));
|
|
97504
|
+
const endPercent = (endMode === 'percent' ? end : dataToStatePoint(end, this._stateScale, this._isHorizontal));
|
|
97505
|
+
this._handleChange(startPercent, endPercent, true);
|
|
97506
|
+
}
|
|
97507
|
+
enableInteraction() {
|
|
97508
|
+
this._dataFilterEvent.enableInteraction();
|
|
97509
|
+
}
|
|
97510
|
+
disableInteraction() {
|
|
97511
|
+
this._dataFilterEvent.disableInteraction();
|
|
97512
|
+
}
|
|
97513
|
+
zoomIn(location) {
|
|
97514
|
+
this._dataFilterEvent.zoomIn(location);
|
|
97515
|
+
}
|
|
97516
|
+
zoomOut(location) {
|
|
97517
|
+
this._dataFilterEvent.zoomOut(location);
|
|
97518
|
+
}
|
|
97519
|
+
_initEvent() {
|
|
97520
|
+
var _a;
|
|
97521
|
+
this._dataFilterEvent.initZoomEvent();
|
|
97522
|
+
(_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.event.on(ChartEvent.scaleRawDomainUpdate, ({ model }) => {
|
|
97523
|
+
console.log('scaleRawDomainUpdate', model.getRawDomain());
|
|
97524
|
+
});
|
|
97525
|
+
}
|
|
97151
97526
|
_handleChange(start, end, updateComponent) {
|
|
97152
97527
|
var _a, _b;
|
|
97153
97528
|
const zoomLock = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.zoomLock) !== null && _b !== void 0 ? _b : false;
|
|
@@ -97161,18 +97536,10 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97161
97536
|
this._spanCache = end - start;
|
|
97162
97537
|
}
|
|
97163
97538
|
}
|
|
97164
|
-
_isReverse() {
|
|
97165
|
-
const axis = this._relatedAxisComponent;
|
|
97166
|
-
if (!axis) {
|
|
97167
|
-
return false;
|
|
97168
|
-
}
|
|
97169
|
-
const axisScale = axis.getScale();
|
|
97170
|
-
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || this._isHorizontal);
|
|
97171
|
-
}
|
|
97172
97539
|
_updateRangeFactor(tag) {
|
|
97173
97540
|
const axis = this._relatedAxisComponent;
|
|
97174
97541
|
const axisScale = axis.getScale();
|
|
97175
|
-
const reverse = this.
|
|
97542
|
+
const reverse = isReverse(axis, this._isHorizontal);
|
|
97176
97543
|
const newRangeFactor = reverse ? [1 - this._end, 1 - this._start] : [this._start, this._end];
|
|
97177
97544
|
if (reverse) {
|
|
97178
97545
|
switch (tag) {
|
|
@@ -97219,23 +97586,16 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97219
97586
|
this._orient = 'left';
|
|
97220
97587
|
this._cacheVisibility = undefined;
|
|
97221
97588
|
this._dataUpdating = false;
|
|
97589
|
+
this._hasInitStateScale = false;
|
|
97222
97590
|
this._shouldChange = true;
|
|
97223
97591
|
this._stateField = 'x';
|
|
97224
|
-
this.
|
|
97225
|
-
|
|
97226
|
-
|
|
97227
|
-
|
|
97228
|
-
|
|
97229
|
-
|
|
97230
|
-
|
|
97231
|
-
enable: true,
|
|
97232
|
-
rate: 1,
|
|
97233
|
-
reverse: true
|
|
97234
|
-
};
|
|
97235
|
-
this._scrollAttr = {
|
|
97236
|
-
enable: true,
|
|
97237
|
-
rate: 1,
|
|
97238
|
-
reverse: true
|
|
97592
|
+
this._handleStateChange = (startValue, endValue, tag) => {
|
|
97593
|
+
var _a, _b;
|
|
97594
|
+
this._startValue = startValue;
|
|
97595
|
+
this._endValue = endValue;
|
|
97596
|
+
this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
|
|
97597
|
+
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
|
|
97598
|
+
return true;
|
|
97239
97599
|
};
|
|
97240
97600
|
this.effect = {
|
|
97241
97601
|
onZoomChange: (tag) => {
|
|
@@ -97244,7 +97604,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97244
97604
|
if (axis && this._filterMode === 'axis') {
|
|
97245
97605
|
const axisScale = axis.getScale();
|
|
97246
97606
|
const axisSpec = axis.getSpec();
|
|
97247
|
-
if (this._auto &&
|
|
97607
|
+
if (this._auto && getAxisBandSize(axisSpec) && this._spec.ignoreBandSize) {
|
|
97248
97608
|
axisScale.bandwidth('auto');
|
|
97249
97609
|
axisScale.maxBandwidth('auto');
|
|
97250
97610
|
axisScale.minBandwidth('auto');
|
|
@@ -97275,92 +97635,14 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97275
97635
|
}
|
|
97276
97636
|
};
|
|
97277
97637
|
this._visible = true;
|
|
97278
|
-
this._handleStateChange = (startValue, endValue, tag) => {
|
|
97279
|
-
var _a, _b;
|
|
97280
|
-
this._startValue = startValue;
|
|
97281
|
-
this._endValue = endValue;
|
|
97282
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97283
|
-
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
|
|
97284
|
-
return true;
|
|
97285
|
-
};
|
|
97286
|
-
this._handleChartZoom = (params, e) => {
|
|
97287
|
-
var _a, _b;
|
|
97288
|
-
if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
|
|
97289
|
-
return;
|
|
97290
|
-
}
|
|
97291
|
-
const { zoomDelta, zoomX, zoomY } = params;
|
|
97292
|
-
const { x, y } = this._regions[0].getLayoutStartPoint();
|
|
97293
|
-
const { width, height } = this._regions[0].getLayoutRect();
|
|
97294
|
-
const delta = Math.abs(this._start - this._end);
|
|
97295
|
-
const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
|
|
97296
|
-
if (delta >= 1 && zoomDelta < 1) {
|
|
97297
|
-
return;
|
|
97298
|
-
}
|
|
97299
|
-
if (delta <= 0.01 && zoomDelta > 1) {
|
|
97300
|
-
return;
|
|
97301
|
-
}
|
|
97302
|
-
const focusLoc = this._isHorizontal ? zoomX : zoomY;
|
|
97303
|
-
const totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
97304
|
-
let startValue = totalValue / 2;
|
|
97305
|
-
let endValue = totalValue / 2;
|
|
97306
|
-
if (focusLoc) {
|
|
97307
|
-
const startLoc = this._isHorizontal ? x : y;
|
|
97308
|
-
const endLoc = this._isHorizontal ? width : height;
|
|
97309
|
-
startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97310
|
-
endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97311
|
-
}
|
|
97312
|
-
const start = clamp$1(this._start + startValue, 0, 1);
|
|
97313
|
-
const end = clamp$1(this._end - endValue, 0, 1);
|
|
97314
|
-
this._handleChange(Math.min(start, end), Math.max(start, end), true);
|
|
97315
|
-
};
|
|
97316
|
-
this._handleChartScroll = (params, e) => {
|
|
97317
|
-
var _a;
|
|
97318
|
-
if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
|
|
97319
|
-
return false;
|
|
97320
|
-
}
|
|
97321
|
-
const { scrollX, scrollY } = params;
|
|
97322
|
-
let value = this._isHorizontal ? scrollX : scrollY;
|
|
97323
|
-
const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
|
|
97324
|
-
if (!this._scrollAttr.reverse) {
|
|
97325
|
-
value = -value;
|
|
97326
|
-
}
|
|
97327
|
-
if (active) {
|
|
97328
|
-
this._handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97329
|
-
}
|
|
97330
|
-
const hasChange = this._start !== 0 && this._end !== 1;
|
|
97331
|
-
return active && hasChange;
|
|
97332
|
-
};
|
|
97333
|
-
this._handleChartDrag = (delta, e) => {
|
|
97334
|
-
var _a, _b;
|
|
97335
|
-
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
97336
|
-
return;
|
|
97337
|
-
}
|
|
97338
|
-
if ((_a = this._spec.roamDrag) === null || _a === void 0 ? void 0 : _a.autoVisible) {
|
|
97339
|
-
this.show();
|
|
97340
|
-
}
|
|
97341
|
-
const [dx, dy] = delta;
|
|
97342
|
-
let value = this._isHorizontal ? dx : dy;
|
|
97343
|
-
if (this._dragAttr.reverse) {
|
|
97344
|
-
value = -value;
|
|
97345
|
-
}
|
|
97346
|
-
this._handleChartMove(value, (_b = this._dragAttr.rate) !== null && _b !== void 0 ? _b : 1);
|
|
97347
|
-
};
|
|
97348
|
-
this._handleChartMove = (value, rate) => {
|
|
97349
|
-
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
97350
|
-
if (Math.abs(value) >= 1e-6) {
|
|
97351
|
-
if (value > 0 && this._end < 1) {
|
|
97352
|
-
const moveDelta = Math.min(1 - this._end, value / totalValue) * rate;
|
|
97353
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97354
|
-
}
|
|
97355
|
-
else if (value < 0 && this._start > 0) {
|
|
97356
|
-
const moveDelta = Math.max(-this._start, value / totalValue) * rate;
|
|
97357
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97358
|
-
}
|
|
97359
|
-
}
|
|
97360
|
-
return false;
|
|
97361
|
-
};
|
|
97362
97638
|
this._orient = getOrient(spec);
|
|
97363
97639
|
this._isHorizontal = getDirectionByOrient(this._orient) === "horizontal";
|
|
97640
|
+
this._dataFilterEvent = new DataFilterEvent(this.type, this._spec, this._handleChange.bind(this), this.getLayoutRect.bind(this), () => {
|
|
97641
|
+
return {
|
|
97642
|
+
start: this._start,
|
|
97643
|
+
end: this._end
|
|
97644
|
+
};
|
|
97645
|
+
}, () => this._regions, (() => this._option).bind(this), () => this.event);
|
|
97364
97646
|
}
|
|
97365
97647
|
created() {
|
|
97366
97648
|
super.created();
|
|
@@ -97375,6 +97657,88 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97375
97657
|
super.initLayout();
|
|
97376
97658
|
this._layout && (this._layout.layoutOrient = this._orient);
|
|
97377
97659
|
}
|
|
97660
|
+
init(option) {
|
|
97661
|
+
super.init(option);
|
|
97662
|
+
this._addTransformToSeries();
|
|
97663
|
+
if (this._start !== 0 || this._end !== 1) {
|
|
97664
|
+
this.effect.onZoomChange();
|
|
97665
|
+
}
|
|
97666
|
+
}
|
|
97667
|
+
_compareSpec(spec, prevSpec) {
|
|
97668
|
+
const result = super._compareSpec(spec, prevSpec);
|
|
97669
|
+
if (!result.reMake && !isEqual(prevSpec, spec)) {
|
|
97670
|
+
result.reRender = true;
|
|
97671
|
+
result.reMake = true;
|
|
97672
|
+
}
|
|
97673
|
+
return result;
|
|
97674
|
+
}
|
|
97675
|
+
reInit(spec) {
|
|
97676
|
+
super.reInit(spec);
|
|
97677
|
+
this._marks.forEach(g => {
|
|
97678
|
+
g.getMarks().forEach(m => {
|
|
97679
|
+
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
97680
|
+
});
|
|
97681
|
+
});
|
|
97682
|
+
}
|
|
97683
|
+
onLayoutStart(layoutRect, viewRect) {
|
|
97684
|
+
super.onLayoutStart(layoutRect, viewRect);
|
|
97685
|
+
const isShown = this._autoUpdate(layoutRect);
|
|
97686
|
+
this._autoVisible(isShown);
|
|
97687
|
+
this._dataUpdating = false;
|
|
97688
|
+
}
|
|
97689
|
+
updateLayoutAttribute() {
|
|
97690
|
+
this._visible && this._createOrUpdateComponent();
|
|
97691
|
+
if (!this._hasInitStateScale) {
|
|
97692
|
+
if (this._start !== 0 || this._end !== 1) {
|
|
97693
|
+
this._newDomain = parseDomainFromStateAndValue(this._spec.start, this._startValue, this._spec.end, this._endValue, this._stateScale);
|
|
97694
|
+
this.effect.onZoomChange();
|
|
97695
|
+
}
|
|
97696
|
+
this._hasInitStateScale = true;
|
|
97697
|
+
}
|
|
97698
|
+
}
|
|
97699
|
+
_initAfterLayout() {
|
|
97700
|
+
this._stateScale = null;
|
|
97701
|
+
this._initStateScale();
|
|
97702
|
+
this._updateScaleRange();
|
|
97703
|
+
this._setStateFromAxis();
|
|
97704
|
+
}
|
|
97705
|
+
_beforeLayoutEnd() {
|
|
97706
|
+
if (!this._hasInitStateScale) {
|
|
97707
|
+
this._initAfterLayout();
|
|
97708
|
+
}
|
|
97709
|
+
else {
|
|
97710
|
+
this._updateScaleRange();
|
|
97711
|
+
}
|
|
97712
|
+
}
|
|
97713
|
+
onLayoutEnd() {
|
|
97714
|
+
var _a;
|
|
97715
|
+
this._beforeLayoutEnd();
|
|
97716
|
+
const isShown = !(this._start === 0 && this._end === 1);
|
|
97717
|
+
this._autoVisible(isShown);
|
|
97718
|
+
super.onLayoutEnd();
|
|
97719
|
+
(_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.updateScaleRange();
|
|
97720
|
+
}
|
|
97721
|
+
getBoundsInRect(rect) {
|
|
97722
|
+
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
97723
|
+
if (this._isHorizontal) {
|
|
97724
|
+
result.y2 = result.y1 + this._height;
|
|
97725
|
+
result.x2 = result.x1 + rect.width;
|
|
97726
|
+
}
|
|
97727
|
+
else {
|
|
97728
|
+
result.x2 = result.x1 + this._width;
|
|
97729
|
+
result.y2 = result.y1 + rect.height;
|
|
97730
|
+
}
|
|
97731
|
+
return result;
|
|
97732
|
+
}
|
|
97733
|
+
setAttrFromSpec() {
|
|
97734
|
+
var _a;
|
|
97735
|
+
super.setAttrFromSpec();
|
|
97736
|
+
this._dataFilterEvent.setEventAttrFromSpec();
|
|
97737
|
+
this._field = this._spec.field;
|
|
97738
|
+
this._width = this._computeWidth();
|
|
97739
|
+
this._height = this._computeHeight();
|
|
97740
|
+
this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
|
|
97741
|
+
}
|
|
97378
97742
|
_setAxisFromSpec() {
|
|
97379
97743
|
if (isValid$1(this._spec.axisId)) {
|
|
97380
97744
|
this._relatedAxisComponent = this._option.getComponentByUserId(this._spec.axisId);
|
|
@@ -97384,7 +97748,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97384
97748
|
}
|
|
97385
97749
|
if (isNil$1(this._spec.field) && !this._relatedAxisComponent) {
|
|
97386
97750
|
const axes = this._option.getComponentsByKey('axes');
|
|
97387
|
-
const sameOrientAxis = axes.find((cm) => cm._orient === this._orient);
|
|
97751
|
+
const sameOrientAxis = axes.find((cm) => getDirectionByOrient(cm._orient) === getDirectionByOrient(this._orient));
|
|
97388
97752
|
if (sameOrientAxis) {
|
|
97389
97753
|
this._relatedAxisComponent = sameOrientAxis;
|
|
97390
97754
|
}
|
|
@@ -97435,33 +97799,9 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97435
97799
|
}
|
|
97436
97800
|
return;
|
|
97437
97801
|
}
|
|
97438
|
-
onDataUpdate() {
|
|
97439
|
-
var _a;
|
|
97440
|
-
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
97441
|
-
this._stateScale.domain(domain, false);
|
|
97442
|
-
this._handleChange(this._start, this._end, true);
|
|
97443
|
-
if (this._spec.auto && !isEqual(this._domainCache, domain)) {
|
|
97444
|
-
this._domainCache = domain;
|
|
97445
|
-
this._dataUpdating = true;
|
|
97446
|
-
(_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
|
|
97447
|
-
}
|
|
97448
|
-
}
|
|
97449
|
-
_computeDomainOfStateScale(isContinuous) {
|
|
97450
|
-
if (this._spec.customDomain) {
|
|
97451
|
-
return this._spec.customDomain;
|
|
97452
|
-
}
|
|
97453
|
-
const domain = this._data.getLatestData().map((d) => d[this._stateField]);
|
|
97454
|
-
if (isContinuous) {
|
|
97455
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97456
|
-
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
|
|
97457
|
-
}
|
|
97458
|
-
return domain;
|
|
97459
|
-
}
|
|
97460
|
-
_initEvent() {
|
|
97461
|
-
this._initCommonEvent();
|
|
97462
|
-
}
|
|
97463
97802
|
_initData() {
|
|
97464
97803
|
const dataCollection = [];
|
|
97804
|
+
const seriesCollection = [];
|
|
97465
97805
|
const stateFields = [];
|
|
97466
97806
|
const valueFields = [];
|
|
97467
97807
|
let isCategoryState;
|
|
@@ -97490,6 +97830,8 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97490
97830
|
? xAxisHelper
|
|
97491
97831
|
: yAxisHelper;
|
|
97492
97832
|
const valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
|
|
97833
|
+
const isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type);
|
|
97834
|
+
const isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
|
|
97493
97835
|
dataCollection.push(s.getRawData());
|
|
97494
97836
|
const seriesSpec = s.getSpec();
|
|
97495
97837
|
const xField = s.coordinate === 'cartesian'
|
|
@@ -97500,16 +97842,17 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97500
97842
|
: array((_b = seriesSpec.radiusField) !== null && _b !== void 0 ? _b : seriesSpec.valueField);
|
|
97501
97843
|
originalStateFields[s.id] =
|
|
97502
97844
|
s.type === 'link' ? ['from_xField'] : stateAxisHelper === xAxisHelper ? xField : yField;
|
|
97503
|
-
if (
|
|
97845
|
+
if (isValidateStateAxis) {
|
|
97504
97846
|
isCategoryState = false;
|
|
97505
97847
|
stateFields.push(originalStateFields[s.id]);
|
|
97506
97848
|
}
|
|
97507
97849
|
else {
|
|
97850
|
+
isCategoryState = true;
|
|
97508
97851
|
stateFields.push(originalStateFields[s.id][0]);
|
|
97509
97852
|
}
|
|
97510
97853
|
if (this._valueField) {
|
|
97511
97854
|
const valueField = s.type === 'link' ? ['from_yField'] : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
97512
|
-
if (
|
|
97855
|
+
if (isValidateValueAxis) {
|
|
97513
97856
|
valueFields.push(...valueField);
|
|
97514
97857
|
}
|
|
97515
97858
|
}
|
|
@@ -97522,6 +97865,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97522
97865
|
else {
|
|
97523
97866
|
eachSeries(this._regions, s => {
|
|
97524
97867
|
dataCollection.push(s.getRawData());
|
|
97868
|
+
seriesCollection.push(s);
|
|
97525
97869
|
stateFields.push(this._field);
|
|
97526
97870
|
if (this._valueField) {
|
|
97527
97871
|
valueFields.push(this._spec.valueField);
|
|
@@ -97540,6 +97884,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97540
97884
|
options: {
|
|
97541
97885
|
input: {
|
|
97542
97886
|
dataCollection: dataCollection,
|
|
97887
|
+
seriesCollection,
|
|
97543
97888
|
stateFields,
|
|
97544
97889
|
valueFields,
|
|
97545
97890
|
isCategoryState
|
|
@@ -97554,136 +97899,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97554
97899
|
data.reRunAllTransform();
|
|
97555
97900
|
dataSet.multipleDataViewAddListener(dataCollection, 'change', this._handleDataCollectionChange.bind(this));
|
|
97556
97901
|
}
|
|
97557
|
-
setAttrFromSpec() {
|
|
97558
|
-
var _a;
|
|
97559
|
-
super.setAttrFromSpec();
|
|
97560
|
-
if (this._spec.roamZoom === true || this._spec.roamZoom) {
|
|
97561
|
-
this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
|
|
97562
|
-
}
|
|
97563
|
-
else {
|
|
97564
|
-
this._zoomAttr.enable = false;
|
|
97565
|
-
}
|
|
97566
|
-
if (this._spec.roamDrag === true || this._spec.roamDrag) {
|
|
97567
|
-
this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
|
|
97568
|
-
}
|
|
97569
|
-
else {
|
|
97570
|
-
this._dragAttr.enable = false;
|
|
97571
|
-
}
|
|
97572
|
-
if (this._spec.roamScroll === true || this._spec.roamScroll) {
|
|
97573
|
-
this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
|
|
97574
|
-
}
|
|
97575
|
-
else {
|
|
97576
|
-
this._scrollAttr.enable = false;
|
|
97577
|
-
}
|
|
97578
|
-
this._field = this._spec.field;
|
|
97579
|
-
this._width = this._computeWidth();
|
|
97580
|
-
this._height = this._computeHeight();
|
|
97581
|
-
this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
|
|
97582
|
-
}
|
|
97583
|
-
statePointToData(state) {
|
|
97584
|
-
const scale = this._stateScale;
|
|
97585
|
-
const domain = scale.domain();
|
|
97586
|
-
if (isContinuous(scale.type)) {
|
|
97587
|
-
if (this._isReverse()) {
|
|
97588
|
-
return domain[0] + (last(domain) - domain[0]) * (1 - state);
|
|
97589
|
-
}
|
|
97590
|
-
return domain[0] + (last(domain) - domain[0]) * state;
|
|
97591
|
-
}
|
|
97592
|
-
let range = scale.range();
|
|
97593
|
-
if (this._isReverse()) {
|
|
97594
|
-
range = range.slice().reverse();
|
|
97595
|
-
}
|
|
97596
|
-
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
97597
|
-
return scale.invert(posInRange);
|
|
97598
|
-
}
|
|
97599
|
-
dataToStatePoint(data) {
|
|
97600
|
-
const scale = this._stateScale;
|
|
97601
|
-
const pos = scale.scale(data);
|
|
97602
|
-
let range = scale.range();
|
|
97603
|
-
if (!this._isHorizontal && isContinuous(scale.type)) {
|
|
97604
|
-
range = range.slice().reverse();
|
|
97605
|
-
}
|
|
97606
|
-
return (pos - range[0]) / (last(range) - range[0]);
|
|
97607
|
-
}
|
|
97608
|
-
_modeCheck(statePoint, mode) {
|
|
97609
|
-
if (statePoint === 'start') {
|
|
97610
|
-
return (mode === 'percent' && isValid$1(this._spec.start)) || (mode === 'value' && isValid$1(this._spec.startValue));
|
|
97611
|
-
}
|
|
97612
|
-
return (mode === 'percent' && isValid$1(this._spec.end)) || (mode === 'value' && isValid$1(this._spec.endValue));
|
|
97613
|
-
}
|
|
97614
|
-
_setStateFromSpec() {
|
|
97615
|
-
var _a, _b;
|
|
97616
|
-
this._auto = !!this._spec.auto;
|
|
97617
|
-
let start;
|
|
97618
|
-
let end;
|
|
97619
|
-
if (this._spec.rangeMode) {
|
|
97620
|
-
const [startMode, endMode] = this._spec.rangeMode;
|
|
97621
|
-
if (this._modeCheck('start', startMode) && this._modeCheck('end', endMode)) {
|
|
97622
|
-
start = startMode === 'percent' ? this._spec.start : this.dataToStatePoint(this._spec.startValue);
|
|
97623
|
-
end = endMode === 'percent' ? this._spec.end : this.dataToStatePoint(this._spec.endValue);
|
|
97624
|
-
}
|
|
97625
|
-
}
|
|
97626
|
-
else {
|
|
97627
|
-
start = this._spec.start
|
|
97628
|
-
? this._spec.start
|
|
97629
|
-
: this._spec.startValue
|
|
97630
|
-
? this.dataToStatePoint(this._spec.startValue)
|
|
97631
|
-
: 0;
|
|
97632
|
-
end = this._spec.end ? this._spec.end : this._spec.endValue ? this.dataToStatePoint(this._spec.endValue) : 1;
|
|
97633
|
-
}
|
|
97634
|
-
this._startValue = this.statePointToData(start);
|
|
97635
|
-
this._endValue = this.statePointToData(end);
|
|
97636
|
-
this._start = start;
|
|
97637
|
-
this._end = end;
|
|
97638
|
-
this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
|
|
97639
|
-
this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
|
|
97640
|
-
if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
|
|
97641
|
-
if (this._spec.minValueSpan) {
|
|
97642
|
-
this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97643
|
-
}
|
|
97644
|
-
if (this._spec.maxValueSpan) {
|
|
97645
|
-
this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97646
|
-
}
|
|
97647
|
-
}
|
|
97648
|
-
this._minSpan = Math.max(0, this._minSpan);
|
|
97649
|
-
this._maxSpan = Math.min(this._maxSpan, 1);
|
|
97650
|
-
if ((!this._relatedAxisComponent || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
|
|
97651
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97652
|
-
}
|
|
97653
|
-
}
|
|
97654
|
-
_parseFieldOfSeries(s) {
|
|
97655
|
-
var _a;
|
|
97656
|
-
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97657
|
-
}
|
|
97658
|
-
_initStateScale() {
|
|
97659
|
-
const defaultRange = [0, 1];
|
|
97660
|
-
if (this._relatedAxisComponent) {
|
|
97661
|
-
const scale = this._relatedAxisComponent.getScale();
|
|
97662
|
-
const isContinuousScale = isContinuous(scale.type);
|
|
97663
|
-
const domain = this._computeDomainOfStateScale(isContinuousScale);
|
|
97664
|
-
this._stateScale = scale.clone();
|
|
97665
|
-
if (isContinuousScale) {
|
|
97666
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97667
|
-
this._stateScale
|
|
97668
|
-
.domain(domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [0, 1], true)
|
|
97669
|
-
.range(defaultRange);
|
|
97670
|
-
}
|
|
97671
|
-
else {
|
|
97672
|
-
this._stateScale.domain(domain, true).range(defaultRange);
|
|
97673
|
-
}
|
|
97674
|
-
}
|
|
97675
|
-
else {
|
|
97676
|
-
this._stateScale = new BandScale();
|
|
97677
|
-
this._stateScale.domain(this._computeDomainOfStateScale(), true).range(defaultRange);
|
|
97678
|
-
}
|
|
97679
|
-
}
|
|
97680
|
-
init(option) {
|
|
97681
|
-
super.init(option);
|
|
97682
|
-
this._addTransformToSeries();
|
|
97683
|
-
if (this._start !== 0 || this._end !== 1) {
|
|
97684
|
-
this.effect.onZoomChange();
|
|
97685
|
-
}
|
|
97686
|
-
}
|
|
97687
97902
|
_addTransformToSeries() {
|
|
97688
97903
|
if (!this._relatedAxisComponent || this._filterMode !== 'axis') {
|
|
97689
97904
|
registerDataSetInstanceTransform(this._option.dataSet, 'dataFilterWithNewDomain', dataFilterWithNewDomain);
|
|
@@ -97722,59 +97937,116 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97722
97937
|
});
|
|
97723
97938
|
}
|
|
97724
97939
|
}
|
|
97725
|
-
|
|
97726
|
-
|
|
97727
|
-
|
|
97728
|
-
|
|
97729
|
-
|
|
97940
|
+
onDataUpdate() {
|
|
97941
|
+
var _a;
|
|
97942
|
+
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
97943
|
+
this._stateScale.domain(domain, false);
|
|
97944
|
+
this._handleChange(this._start, this._end, true);
|
|
97945
|
+
if (this._spec.auto && !isEqual(this._domainCache, domain)) {
|
|
97946
|
+
this._domainCache = domain;
|
|
97947
|
+
this._dataUpdating = true;
|
|
97948
|
+
(_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
|
|
97730
97949
|
}
|
|
97731
|
-
return result;
|
|
97732
97950
|
}
|
|
97733
|
-
|
|
97734
|
-
|
|
97735
|
-
this.
|
|
97736
|
-
g.getMarks().forEach(m => {
|
|
97737
|
-
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
97738
|
-
});
|
|
97739
|
-
});
|
|
97951
|
+
_parseFieldOfSeries(s) {
|
|
97952
|
+
var _a;
|
|
97953
|
+
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97740
97954
|
}
|
|
97741
|
-
|
|
97742
|
-
|
|
97743
|
-
|
|
97955
|
+
_setStateFromSpec() {
|
|
97956
|
+
this._auto = !!this._spec.auto;
|
|
97957
|
+
let start;
|
|
97958
|
+
let end;
|
|
97959
|
+
if (this._spec.rangeMode) {
|
|
97960
|
+
const [startMode, endMode] = this._spec.rangeMode;
|
|
97961
|
+
if (modeCheck('start', startMode, this._spec) && modeCheck('end', endMode, this._spec)) {
|
|
97962
|
+
start =
|
|
97963
|
+
startMode === 'percent'
|
|
97964
|
+
? this._spec.start
|
|
97965
|
+
: dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal);
|
|
97966
|
+
end =
|
|
97967
|
+
endMode === 'percent'
|
|
97968
|
+
? this._spec.end
|
|
97969
|
+
: dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal);
|
|
97970
|
+
}
|
|
97971
|
+
}
|
|
97972
|
+
else {
|
|
97973
|
+
start = this._spec.start
|
|
97974
|
+
? this._spec.start
|
|
97975
|
+
: this._spec.startValue
|
|
97976
|
+
? dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal)
|
|
97977
|
+
: 0;
|
|
97978
|
+
end = this._spec.end
|
|
97979
|
+
? this._spec.end
|
|
97980
|
+
: this._spec.endValue
|
|
97981
|
+
? dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal)
|
|
97982
|
+
: 1;
|
|
97744
97983
|
}
|
|
97745
|
-
|
|
97746
|
-
|
|
97747
|
-
const endIndex = allDomain.indexOf(endValue);
|
|
97748
|
-
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97984
|
+
this._start = Math.max(0, Math.min(1, start));
|
|
97985
|
+
this._end = Math.max(0, Math.min(1, end));
|
|
97749
97986
|
}
|
|
97750
|
-
|
|
97751
|
-
var _a, _b
|
|
97752
|
-
|
|
97753
|
-
const
|
|
97754
|
-
|
|
97755
|
-
|
|
97756
|
-
|
|
97757
|
-
|
|
97758
|
-
|
|
97759
|
-
|
|
97760
|
-
|
|
97761
|
-
|
|
97762
|
-
|
|
97763
|
-
|
|
97764
|
-
|
|
97765
|
-
|
|
97766
|
-
|
|
97767
|
-
|
|
97768
|
-
|
|
97769
|
-
|
|
97770
|
-
|
|
97987
|
+
_setStateFromAxis() {
|
|
97988
|
+
var _a, _b;
|
|
97989
|
+
this._setStateFromSpec();
|
|
97990
|
+
const axis = this._relatedAxisComponent;
|
|
97991
|
+
this._startValue = statePointToData(this._start, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
97992
|
+
this._endValue = statePointToData(this._end, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
97993
|
+
this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
|
|
97994
|
+
this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
|
|
97995
|
+
if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
|
|
97996
|
+
if (this._spec.minValueSpan) {
|
|
97997
|
+
this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97998
|
+
}
|
|
97999
|
+
if (this._spec.maxValueSpan) {
|
|
98000
|
+
this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
98001
|
+
}
|
|
98002
|
+
}
|
|
98003
|
+
this._minSpan = Math.max(0, this._minSpan);
|
|
98004
|
+
this._maxSpan = Math.min(this._maxSpan, 1);
|
|
98005
|
+
if (!axis) {
|
|
98006
|
+
return;
|
|
98007
|
+
}
|
|
98008
|
+
if ((!axis || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
|
|
98009
|
+
this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
|
|
97771
98010
|
}
|
|
97772
98011
|
}
|
|
97773
|
-
|
|
97774
|
-
|
|
97775
|
-
|
|
98012
|
+
_initStateScale() {
|
|
98013
|
+
var _a, _b, _c, _d, _e, _f;
|
|
98014
|
+
const defaultRange = [0, 1];
|
|
98015
|
+
if (this._relatedAxisComponent) {
|
|
98016
|
+
const scale = this._relatedAxisComponent.getScale().clone();
|
|
98017
|
+
this._stateScale = scale;
|
|
98018
|
+
(_b = (_a = scale).maxBandwidth) === null || _b === void 0 ? void 0 : _b.call(_a, 'auto', true);
|
|
98019
|
+
(_d = (_c = scale).minBandwidth) === null || _d === void 0 ? void 0 : _d.call(_c, 'auto', true);
|
|
98020
|
+
(_f = (_e = scale).bandwidth) === null || _f === void 0 ? void 0 : _f.call(_e, 'auto', true);
|
|
98021
|
+
scale.rangeFactor(defaultRange, true).range(defaultRange);
|
|
97776
98022
|
}
|
|
97777
|
-
|
|
98023
|
+
else {
|
|
98024
|
+
let fieldLinear = true;
|
|
98025
|
+
if (this._field) {
|
|
98026
|
+
eachSeries(this._regions, s => {
|
|
98027
|
+
const stats = s.getRawDataStatisticsByField(this._field);
|
|
98028
|
+
if (!isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.min) || !isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.max)) {
|
|
98029
|
+
fieldLinear = false;
|
|
98030
|
+
}
|
|
98031
|
+
}, {
|
|
98032
|
+
userId: this._seriesUserId,
|
|
98033
|
+
specIndex: this._seriesIndex
|
|
98034
|
+
});
|
|
98035
|
+
}
|
|
98036
|
+
this._stateScale = fieldLinear ? new LinearScale() : new BandScale();
|
|
98037
|
+
this._stateScale.domain(this._computeDomainOfStateScale(fieldLinear), true).range(defaultRange);
|
|
98038
|
+
}
|
|
98039
|
+
}
|
|
98040
|
+
_computeDomainOfStateScale(isContinuous) {
|
|
98041
|
+
if (this._spec.customDomain) {
|
|
98042
|
+
return this._spec.customDomain;
|
|
98043
|
+
}
|
|
98044
|
+
const domain = this._data.getLatestData().map((d) => d[this._stateField]);
|
|
98045
|
+
if (isContinuous) {
|
|
98046
|
+
const domainNum = domain.map((n) => n * 1);
|
|
98047
|
+
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
|
|
98048
|
+
}
|
|
98049
|
+
return domain;
|
|
97778
98050
|
}
|
|
97779
98051
|
_autoVisible(isShown) {
|
|
97780
98052
|
if (!this._auto) {
|
|
@@ -97793,29 +98065,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97793
98065
|
[sizeKey]: AttributeLevel.Built_In
|
|
97794
98066
|
});
|
|
97795
98067
|
}
|
|
97796
|
-
onLayoutStart(layoutRect, viewRect) {
|
|
97797
|
-
super.onLayoutStart(layoutRect, viewRect);
|
|
97798
|
-
const isShown = this._autoUpdate(layoutRect);
|
|
97799
|
-
this._autoVisible(isShown);
|
|
97800
|
-
this._dataUpdating = false;
|
|
97801
|
-
}
|
|
97802
|
-
onLayoutEnd() {
|
|
97803
|
-
const isShown = !(this._start === 0 && this._end === 1);
|
|
97804
|
-
this._autoVisible(isShown);
|
|
97805
|
-
super.onLayoutEnd();
|
|
97806
|
-
}
|
|
97807
|
-
getBoundsInRect(rect) {
|
|
97808
|
-
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
97809
|
-
if (this._isHorizontal) {
|
|
97810
|
-
result.y2 = result.y1 + this._height;
|
|
97811
|
-
result.x2 = result.x1 + rect.width;
|
|
97812
|
-
}
|
|
97813
|
-
else {
|
|
97814
|
-
result.x2 = result.x1 + this._width;
|
|
97815
|
-
result.y2 = result.y1 + rect.height;
|
|
97816
|
-
}
|
|
97817
|
-
return result;
|
|
97818
|
-
}
|
|
97819
98068
|
hide() {
|
|
97820
98069
|
var _a;
|
|
97821
98070
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.hideAll();
|
|
@@ -97824,15 +98073,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97824
98073
|
var _a;
|
|
97825
98074
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.showAll();
|
|
97826
98075
|
}
|
|
97827
|
-
_getAxisBandSize(axisSpec) {
|
|
97828
|
-
const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
|
|
97829
|
-
const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
|
|
97830
|
-
const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
|
|
97831
|
-
if (bandSize || minBandSize || maxBandSize) {
|
|
97832
|
-
return { bandSize, maxBandSize, minBandSize };
|
|
97833
|
-
}
|
|
97834
|
-
return undefined;
|
|
97835
|
-
}
|
|
97836
98076
|
_autoUpdate(rect) {
|
|
97837
98077
|
var _a, _b, _c, _d, _e, _f;
|
|
97838
98078
|
if (!this._auto) {
|
|
@@ -97842,7 +98082,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97842
98082
|
const axis = this._relatedAxisComponent;
|
|
97843
98083
|
const axisSpec = axis === null || axis === void 0 ? void 0 : axis.getSpec();
|
|
97844
98084
|
const axisScale = axis === null || axis === void 0 ? void 0 : axis.getScale();
|
|
97845
|
-
const bandSizeResult =
|
|
98085
|
+
const bandSizeResult = getAxisBandSize(axisSpec);
|
|
97846
98086
|
if (!this._dataUpdating &&
|
|
97847
98087
|
isDiscrete(axisScale.type) &&
|
|
97848
98088
|
(rect === null || rect === void 0 ? void 0 : rect.height) === ((_a = this._cacheRect) === null || _a === void 0 ? void 0 : _a.height) &&
|
|
@@ -97889,9 +98129,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97889
98129
|
_getNeedClearVRenderComponents() {
|
|
97890
98130
|
return [this._component];
|
|
97891
98131
|
}
|
|
97892
|
-
clear() {
|
|
97893
|
-
this._throttledHide = null;
|
|
97894
|
-
}
|
|
97895
98132
|
}
|
|
97896
98133
|
mixin(DataFilterBaseComponent, Zoomable);
|
|
97897
98134
|
|
|
@@ -98037,14 +98274,14 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98037
98274
|
this.layoutType = 'region-relative';
|
|
98038
98275
|
this._isReverseCache = false;
|
|
98039
98276
|
this._dataToPositionX = (datum) => {
|
|
98040
|
-
const offsetLeft = this.
|
|
98277
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98041
98278
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98042
98279
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98043
98280
|
const xField = this._isHorizontal ? this._stateField : this._valueField;
|
|
98044
98281
|
return xScale.scale(datum[xField]) + this.getLayoutStartPoint().x + offsetLeft + offsetHandler;
|
|
98045
98282
|
};
|
|
98046
98283
|
this._dataToPositionX2 = (datum) => {
|
|
98047
|
-
const offsetLeft = this.
|
|
98284
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98048
98285
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98049
98286
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98050
98287
|
const min = xScale.domain()[0];
|
|
@@ -98053,63 +98290,146 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98053
98290
|
this._dataToPositionY = (datum) => {
|
|
98054
98291
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98055
98292
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98056
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98293
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98057
98294
|
const yField = this._isHorizontal ? this._valueField : this._stateField;
|
|
98058
98295
|
return yScale.scale(datum[yField]) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98059
98296
|
};
|
|
98060
98297
|
this._dataToPositionY2 = (datum) => {
|
|
98061
98298
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98062
98299
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98063
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98300
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98064
98301
|
const min = yScale.domain()[0];
|
|
98065
98302
|
return yScale.scale(min) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98066
98303
|
};
|
|
98067
98304
|
this._valueField = 'y';
|
|
98068
98305
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'filter';
|
|
98069
98306
|
}
|
|
98307
|
+
_handleChange(start, end, updateComponent, tag) {
|
|
98308
|
+
super._handleChange(start, end, updateComponent);
|
|
98309
|
+
if (this._shouldChange) {
|
|
98310
|
+
if (updateComponent && this._component) {
|
|
98311
|
+
this._component.setStartAndEnd(start, end);
|
|
98312
|
+
}
|
|
98313
|
+
else {
|
|
98314
|
+
const axis = this._relatedAxisComponent;
|
|
98315
|
+
const startValue = statePointToData(start, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
98316
|
+
const endValue = statePointToData(end, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
98317
|
+
if (!isValid$1(startValue) || !isValid$1(endValue)) {
|
|
98318
|
+
return;
|
|
98319
|
+
}
|
|
98320
|
+
this._start = start;
|
|
98321
|
+
this._end = end;
|
|
98322
|
+
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98323
|
+
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98324
|
+
: this._handleStateChange(startValue, endValue, tag);
|
|
98325
|
+
if (hasChange) {
|
|
98326
|
+
this.event.emit(ChartEvent.dataZoomChange, {
|
|
98327
|
+
model: this,
|
|
98328
|
+
value: {
|
|
98329
|
+
filterData: this._filterMode !== 'axis',
|
|
98330
|
+
start,
|
|
98331
|
+
end,
|
|
98332
|
+
startValue: this._startValue,
|
|
98333
|
+
endValue: this._endValue,
|
|
98334
|
+
newDomain: this._newDomain
|
|
98335
|
+
}
|
|
98336
|
+
});
|
|
98337
|
+
}
|
|
98338
|
+
}
|
|
98339
|
+
}
|
|
98340
|
+
}
|
|
98341
|
+
_handleDataCollectionChange() {
|
|
98342
|
+
const data = this._data.getDataView();
|
|
98343
|
+
data.reRunAllTransform();
|
|
98344
|
+
const domain = this._computeDomainOfValueScale();
|
|
98345
|
+
if (domain) {
|
|
98346
|
+
if (!this._valueScale) {
|
|
98347
|
+
this._valueScale = new LinearScale();
|
|
98348
|
+
}
|
|
98349
|
+
this._valueScale.domain(domain);
|
|
98350
|
+
this._updateValueScaleRange();
|
|
98351
|
+
if (this._component) {
|
|
98352
|
+
this._createOrUpdateComponent(true);
|
|
98353
|
+
}
|
|
98354
|
+
}
|
|
98355
|
+
}
|
|
98070
98356
|
created() {
|
|
98071
98357
|
super.created();
|
|
98072
98358
|
this._initValueScale();
|
|
98073
98359
|
}
|
|
98360
|
+
updateLayoutAttribute() {
|
|
98361
|
+
if (this._cacheVisibility !== false) {
|
|
98362
|
+
super.updateLayoutAttribute();
|
|
98363
|
+
}
|
|
98364
|
+
}
|
|
98365
|
+
_beforeLayoutEnd() {
|
|
98366
|
+
super._beforeLayoutEnd();
|
|
98367
|
+
const axis = this._relatedAxisComponent;
|
|
98368
|
+
if ((isReverse(axis, this._isHorizontal) && !this._isReverseCache) || this._auto) {
|
|
98369
|
+
this._isReverseCache = isReverse(axis, this._isHorizontal);
|
|
98370
|
+
this.effect.onZoomChange();
|
|
98371
|
+
}
|
|
98372
|
+
}
|
|
98373
|
+
clear() {
|
|
98374
|
+
if (this._component) {
|
|
98375
|
+
const container = this.getContainer();
|
|
98376
|
+
this._component.removeAllChild();
|
|
98377
|
+
if (container) {
|
|
98378
|
+
container.removeChild(this._component);
|
|
98379
|
+
}
|
|
98380
|
+
this._component = null;
|
|
98381
|
+
}
|
|
98382
|
+
super.clear();
|
|
98383
|
+
}
|
|
98384
|
+
getBoundsInRect(rect) {
|
|
98385
|
+
var _a, _b, _c, _d;
|
|
98386
|
+
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
98387
|
+
const startHandlerScaleXSize = this._startHandlerSize * ((_a = this._spec.startHandler.style.scaleX) !== null && _a !== void 0 ? _a : 1);
|
|
98388
|
+
const startHandlerScaleYSize = this._startHandlerSize * ((_b = this._spec.startHandler.style.scaleY) !== null && _b !== void 0 ? _b : 1);
|
|
98389
|
+
const endHandlerScaleXSize = this._endHandlerSize * ((_c = this._spec.endHandler.style.scaleX) !== null && _c !== void 0 ? _c : 1);
|
|
98390
|
+
const endHandlerScaleYSize = this._endHandlerSize * ((_d = this._spec.endHandler.style.scaleY) !== null && _d !== void 0 ? _d : 1);
|
|
98391
|
+
const extendWidth = !this._visible
|
|
98392
|
+
? 0
|
|
98393
|
+
: this._isHorizontal
|
|
98394
|
+
? (startHandlerScaleXSize - this._startHandlerSize) / 2 + (endHandlerScaleXSize - this._endHandlerSize) / 2
|
|
98395
|
+
: (Math.max(startHandlerScaleXSize, endHandlerScaleXSize) - this._width) / 2;
|
|
98396
|
+
const extendHeight = !this._visible
|
|
98397
|
+
? 0
|
|
98398
|
+
: this._isHorizontal
|
|
98399
|
+
? (Math.max(startHandlerScaleYSize, endHandlerScaleYSize) - this._height) / 2
|
|
98400
|
+
: (startHandlerScaleYSize - this._startHandlerSize) / 2 + (endHandlerScaleYSize - this._endHandlerSize) / 2;
|
|
98401
|
+
if (this._isHorizontal) {
|
|
98402
|
+
result.y2 = result.y1 + this._height + extendHeight;
|
|
98403
|
+
result.x2 = result.x1 + rect.width + extendWidth;
|
|
98404
|
+
}
|
|
98405
|
+
else {
|
|
98406
|
+
result.x2 = result.x1 + this._width + extendWidth;
|
|
98407
|
+
result.y2 = result.y1 + rect.height + extendHeight;
|
|
98408
|
+
}
|
|
98409
|
+
return result;
|
|
98410
|
+
}
|
|
98074
98411
|
setAttrFromSpec() {
|
|
98075
98412
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
98076
98413
|
super.setAttrFromSpec();
|
|
98077
|
-
|
|
98078
|
-
this._zoomAttr.enable = this._spec.roam;
|
|
98079
|
-
this._dragAttr.enable = this._spec.roam;
|
|
98080
|
-
this._scrollAttr.enable = this._spec.roam;
|
|
98081
|
-
}
|
|
98082
|
-
if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
|
|
98083
|
-
this.initZoomable(this.event, this._option.mode);
|
|
98084
|
-
}
|
|
98414
|
+
const componentSize = this._isHorizontal ? Number(this._spec.height) : Number(this._spec.width);
|
|
98085
98415
|
this._backgroundSize = (_b = (_a = this._spec.background) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 30;
|
|
98086
98416
|
this._middleHandlerSize = this._computeMiddleHandlerSize();
|
|
98087
|
-
this._width = this._computeWidth();
|
|
98088
|
-
this._height = this._computeHeight();
|
|
98089
98417
|
if (isNil$1((_e = (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.startHandler) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.size)) {
|
|
98090
|
-
this._spec.startHandler.style.size =
|
|
98091
|
-
? this.
|
|
98092
|
-
:
|
|
98418
|
+
this._spec.startHandler.style.size = isNaN(componentSize)
|
|
98419
|
+
? this._backgroundSize
|
|
98420
|
+
: componentSize - this._middleHandlerSize;
|
|
98093
98421
|
}
|
|
98094
98422
|
if (isNil$1((_h = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.endHandler) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.size)) {
|
|
98095
|
-
this._spec.endHandler.style.size =
|
|
98096
|
-
? this.
|
|
98097
|
-
:
|
|
98098
|
-
}
|
|
98099
|
-
const
|
|
98100
|
-
const
|
|
98101
|
-
this._startHandlerSize =
|
|
98102
|
-
this._endHandlerSize =
|
|
98103
|
-
|
|
98104
|
-
|
|
98105
|
-
this._updateScaleRange();
|
|
98106
|
-
if (this._isReverse() && !this._isReverseCache) {
|
|
98107
|
-
this._isReverseCache = this._isReverse();
|
|
98108
|
-
this.effect.onZoomChange();
|
|
98109
|
-
}
|
|
98110
|
-
if (this._cacheVisibility !== false) {
|
|
98111
|
-
super.onLayoutEnd();
|
|
98112
|
-
}
|
|
98423
|
+
this._spec.endHandler.style.size = isNaN(componentSize)
|
|
98424
|
+
? this._backgroundSize
|
|
98425
|
+
: componentSize - this._middleHandlerSize;
|
|
98426
|
+
}
|
|
98427
|
+
const startHandlerVisible = (_j = this._spec.startHandler.style.visible) !== null && _j !== void 0 ? _j : true;
|
|
98428
|
+
const endHandlerVisible = (_k = this._spec.endHandler.style.visible) !== null && _k !== void 0 ? _k : true;
|
|
98429
|
+
this._startHandlerSize = startHandlerVisible ? this._spec.startHandler.style.size : 0;
|
|
98430
|
+
this._endHandlerSize = endHandlerVisible ? this._spec.endHandler.style.size : 0;
|
|
98431
|
+
this._width = this._computeWidth();
|
|
98432
|
+
this._height = this._computeHeight();
|
|
98113
98433
|
}
|
|
98114
98434
|
_initValueScale() {
|
|
98115
98435
|
const domain = this._computeDomainOfValueScale();
|
|
@@ -98120,9 +98440,13 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98120
98440
|
}
|
|
98121
98441
|
}
|
|
98122
98442
|
_updateScaleRange() {
|
|
98123
|
-
|
|
98443
|
+
this._updateStateScaleRange();
|
|
98444
|
+
this._updateValueScaleRange();
|
|
98445
|
+
}
|
|
98446
|
+
_updateStateScaleRange() {
|
|
98447
|
+
var _a, _b, _c;
|
|
98124
98448
|
const handlerSize = this._startHandlerSize + this._endHandlerSize;
|
|
98125
|
-
if (!this._stateScale
|
|
98449
|
+
if (!this._stateScale) {
|
|
98126
98450
|
return;
|
|
98127
98451
|
}
|
|
98128
98452
|
let stateScaleRange;
|
|
@@ -98139,14 +98463,27 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98139
98463
|
stateScaleRange = this._visible
|
|
98140
98464
|
? [this._startHandlerSize / 2, compWidth - handlerSize + this._startHandlerSize / 2]
|
|
98141
98465
|
: defaultRange;
|
|
98142
|
-
this._stateScale.range(stateScaleRange);
|
|
98143
|
-
this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
|
|
98144
98466
|
}
|
|
98145
98467
|
else {
|
|
98146
98468
|
stateScaleRange = this._visible
|
|
98147
98469
|
? [this._startHandlerSize / 2, compHeight - handlerSize + this._startHandlerSize / 2]
|
|
98148
98470
|
: defaultRange;
|
|
98149
|
-
|
|
98471
|
+
}
|
|
98472
|
+
this._stateScale.range(stateScaleRange);
|
|
98473
|
+
(_c = this._previewStateScale) === null || _c === void 0 ? void 0 : _c.range(isReverse(this._relatedAxisComponent, this._isHorizontal)
|
|
98474
|
+
? stateScaleRange.reverse()
|
|
98475
|
+
: stateScaleRange);
|
|
98476
|
+
}
|
|
98477
|
+
_updateValueScaleRange() {
|
|
98478
|
+
if (!this._valueScale) {
|
|
98479
|
+
return;
|
|
98480
|
+
}
|
|
98481
|
+
const compWidth = this._computeWidth();
|
|
98482
|
+
const compHeight = this._computeHeight();
|
|
98483
|
+
if (this._isHorizontal) {
|
|
98484
|
+
this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
|
|
98485
|
+
}
|
|
98486
|
+
else {
|
|
98150
98487
|
if (this.layoutOrient === 'left') {
|
|
98151
98488
|
this._valueScale.range([compWidth - this._middleHandlerSize, 0]);
|
|
98152
98489
|
}
|
|
@@ -98154,24 +98491,35 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98154
98491
|
this._valueScale.range([0, compWidth - this._middleHandlerSize]);
|
|
98155
98492
|
}
|
|
98156
98493
|
}
|
|
98157
|
-
if (this._component && this._cacheVisibility !== false) {
|
|
98158
|
-
this._component.setAttributes({
|
|
98159
|
-
size: {
|
|
98160
|
-
width: compWidth,
|
|
98161
|
-
height: compHeight
|
|
98162
|
-
},
|
|
98163
|
-
position: {
|
|
98164
|
-
x: this.getLayoutStartPoint().x,
|
|
98165
|
-
y: this.getLayoutStartPoint().y
|
|
98166
|
-
}
|
|
98167
|
-
});
|
|
98168
|
-
}
|
|
98169
98494
|
}
|
|
98170
98495
|
_computeDomainOfValueScale() {
|
|
98171
98496
|
const domain = this._data.getLatestData().map((d) => d[this._valueField]);
|
|
98172
98497
|
const domainNum = domain.map((n) => n * 1);
|
|
98173
98498
|
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : null;
|
|
98174
98499
|
}
|
|
98500
|
+
_isScaleValid(scale) {
|
|
98501
|
+
if (!scale || !scale.domain()) {
|
|
98502
|
+
return false;
|
|
98503
|
+
}
|
|
98504
|
+
const domain = scale.domain();
|
|
98505
|
+
if (isContinuous(scale.type) && domain[0] === last(domain)) {
|
|
98506
|
+
return false;
|
|
98507
|
+
}
|
|
98508
|
+
if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
|
|
98509
|
+
return false;
|
|
98510
|
+
}
|
|
98511
|
+
return true;
|
|
98512
|
+
}
|
|
98513
|
+
_getXScale() {
|
|
98514
|
+
const bindScale = this._relatedAxisComponent.getScale();
|
|
98515
|
+
if (bindScale.type === this.stateScale.type && this._isHorizontal) {
|
|
98516
|
+
return this.stateScale;
|
|
98517
|
+
}
|
|
98518
|
+
return this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98519
|
+
}
|
|
98520
|
+
_getYScale() {
|
|
98521
|
+
return this._isHorizontal ? this._valueScale : this._stateScale;
|
|
98522
|
+
}
|
|
98175
98523
|
_computeMiddleHandlerSize() {
|
|
98176
98524
|
var _a, _b, _c, _d;
|
|
98177
98525
|
let size = 0;
|
|
@@ -98192,7 +98540,8 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98192
98540
|
if (this._isHorizontal) {
|
|
98193
98541
|
return this.getLayoutRect().width;
|
|
98194
98542
|
}
|
|
98195
|
-
return this.
|
|
98543
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98544
|
+
this._middleHandlerSize);
|
|
98196
98545
|
}
|
|
98197
98546
|
_computeHeight() {
|
|
98198
98547
|
if (this._visible === false) {
|
|
@@ -98202,23 +98551,11 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98202
98551
|
return this._spec.height;
|
|
98203
98552
|
}
|
|
98204
98553
|
if (this._isHorizontal) {
|
|
98205
|
-
return this.
|
|
98554
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98555
|
+
this._middleHandlerSize);
|
|
98206
98556
|
}
|
|
98207
98557
|
return this.getLayoutRect().height;
|
|
98208
98558
|
}
|
|
98209
|
-
_isScaleValid(scale) {
|
|
98210
|
-
if (!scale || !scale.domain()) {
|
|
98211
|
-
return false;
|
|
98212
|
-
}
|
|
98213
|
-
const domain = scale.domain();
|
|
98214
|
-
if (isContinuous(scale.type) && domain[0] === last(domain)) {
|
|
98215
|
-
return false;
|
|
98216
|
-
}
|
|
98217
|
-
if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
|
|
98218
|
-
return false;
|
|
98219
|
-
}
|
|
98220
|
-
return true;
|
|
98221
|
-
}
|
|
98222
98559
|
_getAttrs(isNeedPreview) {
|
|
98223
98560
|
var _a, _b, _c, _d, _e;
|
|
98224
98561
|
const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : {};
|
|
@@ -98228,73 +98565,58 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98228
98565
|
}, orient: this._orient, size: {
|
|
98229
98566
|
width: this._computeWidth(),
|
|
98230
98567
|
height: this._computeHeight()
|
|
98231
|
-
}, showDetail: spec.showDetail, brushSelect: (_b = spec.brushSelect) !== null && _b !== void 0 ? _b : false, zoomLock: (_c = spec.zoomLock) !== null && _c !== void 0 ? _c : false, minSpan: this._minSpan, maxSpan: this._maxSpan, delayType: spec.delayType, delayTime: isValid$1(spec.delayType) ? (_d = spec.delayTime) !== null && _d !== void 0 ? _d : 30 : 0, realTime: (_e = spec.realTime) !== null && _e !== void 0 ? _e : true, previewData: isNeedPreview && this._data.getLatestData(), previewPointsX: isNeedPreview && this._dataToPositionX, previewPointsY: isNeedPreview && this._dataToPositionY, tolerance: this._spec.tolerance }, this._getComponentAttrs(isNeedPreview));
|
|
98568
|
+
}, showDetail: spec.showDetail, brushSelect: (_b = spec.brushSelect) !== null && _b !== void 0 ? _b : false, zoomLock: (_c = spec.zoomLock) !== null && _c !== void 0 ? _c : false, minSpan: this._minSpan, maxSpan: this._maxSpan, delayType: spec.delayType, delayTime: isValid$1(spec.delayType) ? ((_d = spec.delayTime) !== null && _d !== void 0 ? _d : 30) : 0, realTime: (_e = spec.realTime) !== null && _e !== void 0 ? _e : true, previewData: isNeedPreview && this._data.getLatestData(), previewPointsX: isNeedPreview && this._dataToPositionX, previewPointsY: isNeedPreview && this._dataToPositionY, tolerance: this._spec.tolerance, isReverse: isReverse(this._relatedAxisComponent, this._isHorizontal) }, this._getComponentAttrs(isNeedPreview));
|
|
98232
98569
|
}
|
|
98233
|
-
|
|
98570
|
+
_getLayoutAttrs() {
|
|
98571
|
+
return {
|
|
98572
|
+
position: {
|
|
98573
|
+
x: this.getLayoutStartPoint().x,
|
|
98574
|
+
y: this.getLayoutStartPoint().y
|
|
98575
|
+
},
|
|
98576
|
+
size: {
|
|
98577
|
+
width: this._computeWidth(),
|
|
98578
|
+
height: this._computeHeight()
|
|
98579
|
+
}
|
|
98580
|
+
};
|
|
98581
|
+
}
|
|
98582
|
+
_createOrUpdateComponent(changeData) {
|
|
98234
98583
|
if (this._visible) {
|
|
98235
98584
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98236
98585
|
const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
|
|
98237
98586
|
const isNeedPreview = this._isScaleValid(xScale) && this._isScaleValid(yScale) && this._spec.showBackgroundChart !== false;
|
|
98238
98587
|
const attrs = this._getAttrs(isNeedPreview);
|
|
98588
|
+
const axis = this._relatedAxisComponent;
|
|
98239
98589
|
if (this._component) {
|
|
98240
98590
|
this._component.setAttributes(attrs);
|
|
98591
|
+
if (changeData) {
|
|
98592
|
+
this._component.setPreviewData(this._data.getDataView().latestData);
|
|
98593
|
+
if (isNeedPreview) {
|
|
98594
|
+
if (this._isHorizontal) {
|
|
98595
|
+
this._component.setPreviewPointsY1(this._dataToPositionY2);
|
|
98596
|
+
}
|
|
98597
|
+
else {
|
|
98598
|
+
this._component.setPreviewPointsX1(this._dataToPositionX2);
|
|
98599
|
+
}
|
|
98600
|
+
this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
|
|
98601
|
+
}
|
|
98602
|
+
}
|
|
98241
98603
|
}
|
|
98242
98604
|
else {
|
|
98243
98605
|
const container = this.getContainer();
|
|
98244
98606
|
this._component = new DataZoom$1(attrs);
|
|
98607
|
+
this._component.setPreviewData(this._data.getDataView().latestData);
|
|
98245
98608
|
if (this._isHorizontal) {
|
|
98246
98609
|
isNeedPreview && this._component.setPreviewPointsY1(this._dataToPositionY2);
|
|
98247
98610
|
}
|
|
98248
98611
|
else {
|
|
98249
98612
|
isNeedPreview && this._component.setPreviewPointsX1(this._dataToPositionX2);
|
|
98250
98613
|
}
|
|
98251
|
-
this._component.setStatePointToData((state) => this.
|
|
98252
|
-
this._component.addEventListener('
|
|
98614
|
+
this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
|
|
98615
|
+
this._component.addEventListener('dataZoomChange', (e) => {
|
|
98253
98616
|
const { start, end, tag } = e.detail;
|
|
98254
98617
|
this._handleChange(start, end, undefined, tag);
|
|
98255
98618
|
});
|
|
98256
98619
|
container.add(this._component);
|
|
98257
|
-
this._updateScaleRange();
|
|
98258
|
-
}
|
|
98259
|
-
}
|
|
98260
|
-
}
|
|
98261
|
-
_handleChange(start, end, updateComponent, tag) {
|
|
98262
|
-
super._handleChange(start, end, updateComponent);
|
|
98263
|
-
if (this._shouldChange) {
|
|
98264
|
-
if (updateComponent && this._component) {
|
|
98265
|
-
this._component.setStartAndEnd(start, end);
|
|
98266
|
-
}
|
|
98267
|
-
this._start = start;
|
|
98268
|
-
this._end = end;
|
|
98269
|
-
const startValue = this.statePointToData(start);
|
|
98270
|
-
const endValue = this.statePointToData(end);
|
|
98271
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98272
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98273
|
-
: this._handleStateChange(startValue, endValue, tag);
|
|
98274
|
-
if (hasChange) {
|
|
98275
|
-
this.event.emit(ChartEvent.dataZoomChange, {
|
|
98276
|
-
model: this,
|
|
98277
|
-
value: {
|
|
98278
|
-
filterData: this._filterMode !== 'axis',
|
|
98279
|
-
start,
|
|
98280
|
-
end,
|
|
98281
|
-
startValue: this._startValue,
|
|
98282
|
-
endValue: this._endValue,
|
|
98283
|
-
newDomain: this._newDomain
|
|
98284
|
-
}
|
|
98285
|
-
});
|
|
98286
|
-
}
|
|
98287
|
-
}
|
|
98288
|
-
}
|
|
98289
|
-
_handleDataCollectionChange() {
|
|
98290
|
-
var _a;
|
|
98291
|
-
const data = this._data.getDataView();
|
|
98292
|
-
data.reRunAllTransform();
|
|
98293
|
-
(_a = this._component) === null || _a === void 0 ? void 0 : _a.setPreviewData(data.latestData);
|
|
98294
|
-
if (this._valueScale) {
|
|
98295
|
-
const domain = this._computeDomainOfValueScale();
|
|
98296
|
-
if (domain) {
|
|
98297
|
-
this._valueScale.domain(domain);
|
|
98298
98620
|
}
|
|
98299
98621
|
}
|
|
98300
98622
|
}
|
|
@@ -98356,16 +98678,23 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98356
98678
|
_getNeedClearVRenderComponents() {
|
|
98357
98679
|
return [this._component];
|
|
98358
98680
|
}
|
|
98359
|
-
|
|
98360
|
-
|
|
98361
|
-
|
|
98362
|
-
this.
|
|
98363
|
-
|
|
98364
|
-
|
|
98681
|
+
onDataUpdate() {
|
|
98682
|
+
super.onDataUpdate();
|
|
98683
|
+
if (this._previewStateScale !== this._stateScale) {
|
|
98684
|
+
this._previewStateScale = null;
|
|
98685
|
+
}
|
|
98686
|
+
}
|
|
98687
|
+
_getPreviewStateScale() {
|
|
98688
|
+
if (!this._previewStateScale) {
|
|
98689
|
+
if (isReverse(this._relatedAxisComponent, this._isHorizontal)) {
|
|
98690
|
+
this._previewStateScale = this._stateScale.clone();
|
|
98691
|
+
this._previewStateScale.range(this._stateScale.range().reverse());
|
|
98692
|
+
}
|
|
98693
|
+
else {
|
|
98694
|
+
this._previewStateScale = this._stateScale;
|
|
98365
98695
|
}
|
|
98366
|
-
this._component = null;
|
|
98367
98696
|
}
|
|
98368
|
-
|
|
98697
|
+
return this._previewStateScale;
|
|
98369
98698
|
}
|
|
98370
98699
|
}
|
|
98371
98700
|
DataZoom.type = ComponentTypeEnum.dataZoom;
|
|
@@ -98410,24 +98739,53 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98410
98739
|
this.layoutType = 'region-relative';
|
|
98411
98740
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'axis';
|
|
98412
98741
|
}
|
|
98413
|
-
|
|
98414
|
-
super.
|
|
98415
|
-
|
|
98416
|
-
|
|
98417
|
-
|
|
98418
|
-
|
|
98742
|
+
_handleChange(start, end, updateComponent) {
|
|
98743
|
+
super._handleChange(start, end, updateComponent);
|
|
98744
|
+
const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
|
|
98745
|
+
if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
|
|
98746
|
+
if (updateComponent && this._component) {
|
|
98747
|
+
this._component.setAttribute('range', [start, end]);
|
|
98748
|
+
}
|
|
98749
|
+
this._start = start;
|
|
98750
|
+
this._end = end;
|
|
98751
|
+
const startValue = statePointToData(start, this._stateScale, false);
|
|
98752
|
+
const endValue = statePointToData(end, this._stateScale, false);
|
|
98753
|
+
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98754
|
+
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98755
|
+
: this._handleStateChange(startValue, endValue);
|
|
98756
|
+
if (hasChange) {
|
|
98757
|
+
this.event.emit(ChartEvent.scrollBarChange, {
|
|
98758
|
+
model: this,
|
|
98759
|
+
value: {
|
|
98760
|
+
filterData: this._filterMode !== 'axis',
|
|
98761
|
+
start: this._start,
|
|
98762
|
+
end: this._end,
|
|
98763
|
+
startValue: this._startValue,
|
|
98764
|
+
endValue: this._endValue,
|
|
98765
|
+
newDomain: this._newDomain
|
|
98766
|
+
}
|
|
98767
|
+
});
|
|
98768
|
+
}
|
|
98419
98769
|
}
|
|
98420
|
-
|
|
98421
|
-
|
|
98770
|
+
}
|
|
98771
|
+
_handleDataCollectionChange() {
|
|
98772
|
+
if (this._spec.auto) {
|
|
98773
|
+
const data = this._data.getDataView();
|
|
98774
|
+
data.reRunAllTransform();
|
|
98422
98775
|
}
|
|
98423
98776
|
}
|
|
98424
|
-
|
|
98777
|
+
_beforeLayoutEnd() {
|
|
98425
98778
|
var _a, _b;
|
|
98426
|
-
|
|
98779
|
+
super._beforeLayoutEnd();
|
|
98427
98780
|
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
98781
|
+
}
|
|
98782
|
+
onLayoutEnd() {
|
|
98783
|
+
this._updateComponentBounds();
|
|
98428
98784
|
super.onLayoutEnd();
|
|
98429
98785
|
}
|
|
98430
98786
|
_updateScaleRange() {
|
|
98787
|
+
}
|
|
98788
|
+
_updateComponentBounds() {
|
|
98431
98789
|
if (this._component) {
|
|
98432
98790
|
this._component.setAttributes({
|
|
98433
98791
|
x: this.getLayoutStartPoint().x,
|
|
@@ -98438,6 +98796,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98438
98796
|
}
|
|
98439
98797
|
}
|
|
98440
98798
|
_computeWidth() {
|
|
98799
|
+
if (this._visible === false) {
|
|
98800
|
+
return 0;
|
|
98801
|
+
}
|
|
98441
98802
|
if (isNumber$1(this._spec.width)) {
|
|
98442
98803
|
return this._spec.width;
|
|
98443
98804
|
}
|
|
@@ -98447,6 +98808,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98447
98808
|
return SCROLL_BAR_DEFAULT_SIZE;
|
|
98448
98809
|
}
|
|
98449
98810
|
_computeHeight() {
|
|
98811
|
+
if (this._visible === false) {
|
|
98812
|
+
return 0;
|
|
98813
|
+
}
|
|
98450
98814
|
if (isNumber$1(this._spec.height)) {
|
|
98451
98815
|
return this._spec.height;
|
|
98452
98816
|
}
|
|
@@ -98457,7 +98821,7 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98457
98821
|
}
|
|
98458
98822
|
_getAttrs() {
|
|
98459
98823
|
var _a, _b, _c, _d, _e, _f;
|
|
98460
|
-
return Object.assign({ zIndex: this.layoutZIndex, x: this.getLayoutStartPoint().x, y: this.getLayoutStartPoint().y, width: this.getLayoutRect().width, height: this.getLayoutRect().height, range: [this._start, this._end], direction: this._isHorizontal ? 'horizontal' : 'vertical', delayType: (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType, delayTime: isValid$1((_b = this._spec) === null || _b === void 0 ? void 0 : _b.delayType) ? (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayTime) !== null && _d !== void 0 ? _d : 30 : 0, realTime: (_f = (_e = this._spec) === null || _e === void 0 ? void 0 : _e.realTime) !== null && _f !== void 0 ? _f : true }, this._getComponentAttrs());
|
|
98824
|
+
return Object.assign({ zIndex: this.layoutZIndex, x: this.getLayoutStartPoint().x, y: this.getLayoutStartPoint().y, width: this.getLayoutRect().width, height: this.getLayoutRect().height, range: [this._start, this._end], direction: this._isHorizontal ? 'horizontal' : 'vertical', delayType: (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType, delayTime: isValid$1((_b = this._spec) === null || _b === void 0 ? void 0 : _b.delayType) ? ((_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayTime) !== null && _d !== void 0 ? _d : 30) : 0, realTime: (_f = (_e = this._spec) === null || _e === void 0 ? void 0 : _e.realTime) !== null && _f !== void 0 ? _f : true }, this._getComponentAttrs());
|
|
98461
98825
|
}
|
|
98462
98826
|
_createOrUpdateComponent() {
|
|
98463
98827
|
const attrs = this._getAttrs();
|
|
@@ -98478,41 +98842,6 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98478
98842
|
container.add(this._component);
|
|
98479
98843
|
}
|
|
98480
98844
|
}
|
|
98481
|
-
_handleChange(start, end, updateComponent) {
|
|
98482
|
-
super._handleChange(start, end, updateComponent);
|
|
98483
|
-
const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
|
|
98484
|
-
if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
|
|
98485
|
-
if (updateComponent && this._component) {
|
|
98486
|
-
this._component.setAttribute('range', [start, end]);
|
|
98487
|
-
}
|
|
98488
|
-
this._start = start;
|
|
98489
|
-
this._end = end;
|
|
98490
|
-
const startValue = this.statePointToData(start);
|
|
98491
|
-
const endValue = this.statePointToData(end);
|
|
98492
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98493
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98494
|
-
: this._handleStateChange(this.statePointToData(start), this.statePointToData(end));
|
|
98495
|
-
if (hasChange) {
|
|
98496
|
-
this.event.emit(ChartEvent.scrollBarChange, {
|
|
98497
|
-
model: this,
|
|
98498
|
-
value: {
|
|
98499
|
-
filterData: this._filterMode !== 'axis',
|
|
98500
|
-
start: this._start,
|
|
98501
|
-
end: this._end,
|
|
98502
|
-
startValue: this._startValue,
|
|
98503
|
-
endValue: this._endValue,
|
|
98504
|
-
newDomain: this._newDomain
|
|
98505
|
-
}
|
|
98506
|
-
});
|
|
98507
|
-
}
|
|
98508
|
-
}
|
|
98509
|
-
}
|
|
98510
|
-
_handleDataCollectionChange() {
|
|
98511
|
-
if (this._spec.auto) {
|
|
98512
|
-
const data = this._data.getDataView();
|
|
98513
|
-
data.reRunAllTransform();
|
|
98514
|
-
}
|
|
98515
|
-
}
|
|
98516
98845
|
_getComponentAttrs() {
|
|
98517
98846
|
const { rail, slider, innerPadding } = this._spec;
|
|
98518
98847
|
const attrs = {};
|
|
@@ -102648,17 +102977,13 @@ class Brush extends BaseComponent {
|
|
|
102648
102977
|
const axisRangeExpand = (_a = this._spec.axisRangeExpand) !== null && _a !== void 0 ? _a : 0;
|
|
102649
102978
|
const { x1, x2, y1, y2 } = operateMaskBounds;
|
|
102650
102979
|
const regionStartAttr = isHorizontal ? 'x' : 'y';
|
|
102980
|
+
const regionSizeAttr = isHorizontal ? 'width' : 'height';
|
|
102651
102981
|
const boundsStart = isHorizontal ? x1 : y1;
|
|
102652
102982
|
const boundsEnd = isHorizontal ? x2 : y2;
|
|
102653
102983
|
if (this._axisDataZoomMap[axis.id]) {
|
|
102654
102984
|
const dataZoom = this._axisDataZoomMap[axis.id];
|
|
102655
|
-
const
|
|
102656
|
-
const
|
|
102657
|
-
.getScale()
|
|
102658
|
-
.invert(boundsStart - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102659
|
-
const endValue = releatedAxis.getScale().invert(boundsEnd - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102660
|
-
const startPercent = dataZoom.dataToStatePoint(startValue);
|
|
102661
|
-
const endPercent = dataZoom.dataToStatePoint(endValue);
|
|
102985
|
+
const startPercent = (boundsStart - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
|
|
102986
|
+
const endPercent = (boundsEnd - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
|
|
102662
102987
|
const newStartPercent = this._stateClamp(startPercent - axisRangeExpand);
|
|
102663
102988
|
const newEndPercent = this._stateClamp(endPercent + axisRangeExpand);
|
|
102664
102989
|
dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), [
|
|
@@ -102669,8 +102994,8 @@ class Brush extends BaseComponent {
|
|
|
102669
102994
|
operateComponent: dataZoom,
|
|
102670
102995
|
start: newStartPercent,
|
|
102671
102996
|
end: newEndPercent,
|
|
102672
|
-
startValue: dataZoom.
|
|
102673
|
-
endValue: dataZoom.
|
|
102997
|
+
startValue: statePointToData(newStartPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal)),
|
|
102998
|
+
endValue: statePointToData(newEndPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal))
|
|
102674
102999
|
});
|
|
102675
103000
|
}
|
|
102676
103001
|
else {
|