@visactor/vchart 2.0.8 → 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 -558
- package/build/index.js +908 -558
- 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/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/component/marker/utils.js +1 -1
- package/cjs/component/marker/utils.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/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/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/component/marker/utils.js +1 -1
- package/esm/component/marker/utils.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/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);
|
|
@@ -61290,7 +61389,7 @@ const lookup = (data, opt) => {
|
|
|
61290
61389
|
});
|
|
61291
61390
|
};
|
|
61292
61391
|
|
|
61293
|
-
const version = "2.0.
|
|
61392
|
+
const version = "2.0.9";
|
|
61294
61393
|
|
|
61295
61394
|
const addVChartProperty = (data, op) => {
|
|
61296
61395
|
const context = op.beforeCall();
|
|
@@ -62340,6 +62439,7 @@ class BaseSeries extends BaseModel {
|
|
|
62340
62439
|
this.initMarkState();
|
|
62341
62440
|
if (hasAnimation) {
|
|
62342
62441
|
this.initAnimation();
|
|
62442
|
+
this.initStageAnimation();
|
|
62343
62443
|
}
|
|
62344
62444
|
this.afterInitMark();
|
|
62345
62445
|
this.initEvent();
|
|
@@ -62796,6 +62896,13 @@ class BaseSeries extends BaseModel {
|
|
|
62796
62896
|
}
|
|
62797
62897
|
initAnimation() {
|
|
62798
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
|
+
}
|
|
62799
62906
|
initMarkState() {
|
|
62800
62907
|
this.initSeriesStyleState();
|
|
62801
62908
|
}
|
|
@@ -65666,7 +65773,7 @@ class AxisComponent extends BaseComponent {
|
|
|
65666
65773
|
const viewData = s.getViewData();
|
|
65667
65774
|
if (rawData) {
|
|
65668
65775
|
field.forEach(f => {
|
|
65669
|
-
data.push(s.getRawDataStatisticsByField(f,
|
|
65776
|
+
data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
|
|
65670
65777
|
});
|
|
65671
65778
|
}
|
|
65672
65779
|
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
@@ -66929,8 +67036,12 @@ const DEFAULT_TICK_COUNT = 5;
|
|
|
66929
67036
|
class LinearAxisMixin {
|
|
66930
67037
|
constructor() {
|
|
66931
67038
|
this._extend = {};
|
|
67039
|
+
this._rawDomain = [];
|
|
66932
67040
|
this.niceLabelFormatter = null;
|
|
66933
67041
|
}
|
|
67042
|
+
getRawDomain() {
|
|
67043
|
+
return this._rawDomain;
|
|
67044
|
+
}
|
|
66934
67045
|
setExtraAttrFromSpec() {
|
|
66935
67046
|
isValid$1(this._spec.nice) && (this._nice = this._spec.nice);
|
|
66936
67047
|
isValid$1(this._spec.zero) && (this._zero = this._spec.zero);
|
|
@@ -67197,9 +67308,13 @@ class LinearAxisMixin {
|
|
|
67197
67308
|
}
|
|
67198
67309
|
}
|
|
67199
67310
|
updateScaleDomain() {
|
|
67311
|
+
var _a;
|
|
67200
67312
|
if (!this.isSeriesDataEnable()) {
|
|
67201
67313
|
return;
|
|
67202
67314
|
}
|
|
67315
|
+
if (!((_a = this._rawDomain) === null || _a === void 0 ? void 0 : _a.length) && this._scale) {
|
|
67316
|
+
this._updateRawDomain();
|
|
67317
|
+
}
|
|
67203
67318
|
const data = this.collectData();
|
|
67204
67319
|
const domain = this.computeLinearDomain(data);
|
|
67205
67320
|
this.updateScaleDomainByModel(domain);
|
|
@@ -67234,6 +67349,15 @@ class LinearAxisMixin {
|
|
|
67234
67349
|
return value;
|
|
67235
67350
|
};
|
|
67236
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
|
+
}
|
|
67237
67361
|
}
|
|
67238
67362
|
|
|
67239
67363
|
const axisLinear = {
|
|
@@ -67465,6 +67589,7 @@ const registerCartesianLinearAxis = () => {
|
|
|
67465
67589
|
class BandAxisMixin {
|
|
67466
67590
|
constructor() {
|
|
67467
67591
|
this._rawDomainIndex = [];
|
|
67592
|
+
this._rawDomain = [];
|
|
67468
67593
|
}
|
|
67469
67594
|
_initData() {
|
|
67470
67595
|
var _a;
|
|
@@ -67516,6 +67641,9 @@ class BandAxisMixin {
|
|
|
67516
67641
|
tickTransform && (tickTransform.options = this._tickTransformOption());
|
|
67517
67642
|
}
|
|
67518
67643
|
}
|
|
67644
|
+
getRawDomain() {
|
|
67645
|
+
return this._rawDomain;
|
|
67646
|
+
}
|
|
67519
67647
|
dataToPosition(values, cfg = {}) {
|
|
67520
67648
|
var _a, _b;
|
|
67521
67649
|
if (values.length === 0 || this._scales.length === 0) {
|
|
@@ -67653,6 +67781,7 @@ class BandAxisMixin {
|
|
|
67653
67781
|
}
|
|
67654
67782
|
_updateRawDomain() {
|
|
67655
67783
|
this._rawDomainIndex = [];
|
|
67784
|
+
this._rawDomain = [];
|
|
67656
67785
|
const userDomain = this._spec.domain;
|
|
67657
67786
|
for (let i = 0; i < this._scales.length; i++) {
|
|
67658
67787
|
if (userDomain && userDomain.length && i === 0) {
|
|
@@ -67662,12 +67791,15 @@ class BandAxisMixin {
|
|
|
67662
67791
|
const data = this.collectData(i, true);
|
|
67663
67792
|
const domain = this.computeBandDomain(data);
|
|
67664
67793
|
this._rawDomainIndex[i] = {};
|
|
67794
|
+
this._rawDomain[i] = domain;
|
|
67665
67795
|
domain.forEach((d, _i) => (this._rawDomainIndex[i][d] = _i));
|
|
67666
67796
|
}
|
|
67667
67797
|
}
|
|
67798
|
+
this.event.emit(ChartEvent.scaleRawDomainUpdate, { model: this });
|
|
67668
67799
|
}
|
|
67669
67800
|
_clearRawDomain() {
|
|
67670
67801
|
this._rawDomainIndex = [];
|
|
67802
|
+
this._rawDomain = [];
|
|
67671
67803
|
}
|
|
67672
67804
|
}
|
|
67673
67805
|
|
|
@@ -72005,7 +72137,10 @@ function computeOneDatumY(obj, lastY, s, context, seriesScale, isFirst) {
|
|
|
72005
72137
|
lastY = y1;
|
|
72006
72138
|
}
|
|
72007
72139
|
let height = Math.abs(y1 - y);
|
|
72008
|
-
if (height
|
|
72140
|
+
if (height <= 0 && !isValueInScaleDomain(obj[s.getStackValueField()], seriesScale)) {
|
|
72141
|
+
height = 0;
|
|
72142
|
+
}
|
|
72143
|
+
else if (height < barMinHeight) {
|
|
72009
72144
|
height = barMinHeight;
|
|
72010
72145
|
}
|
|
72011
72146
|
let flag = 1;
|
|
@@ -72354,7 +72489,10 @@ class BarSeries extends CartesianSeries {
|
|
|
72354
72489
|
const y1 = valueInScaleRange(this[startMethod](datum), seriesScale, useWholeRange);
|
|
72355
72490
|
const y = valueInScaleRange(this[endMethod](datum), seriesScale, useWholeRange);
|
|
72356
72491
|
let height = Math.abs(y1 - y);
|
|
72357
|
-
if (height
|
|
72492
|
+
if (height <= 0 && !isValueInScaleDomain(datum[this.getStackValueField()], seriesScale)) {
|
|
72493
|
+
height = 0;
|
|
72494
|
+
}
|
|
72495
|
+
else if (height < barMinHeight) {
|
|
72358
72496
|
height = barMinHeight;
|
|
72359
72497
|
}
|
|
72360
72498
|
let flag = 1;
|
|
@@ -79372,13 +79510,14 @@ class DotSeries extends CartesianSeries {
|
|
|
79372
79510
|
});
|
|
79373
79511
|
}
|
|
79374
79512
|
initMarkStyle() {
|
|
79513
|
+
var _a;
|
|
79375
79514
|
const clipMark = this._clipMark;
|
|
79376
79515
|
if (clipMark) {
|
|
79377
79516
|
this.setMarkStyle(clipMark, {
|
|
79378
|
-
x: -this._spec.leftAppendPadding,
|
|
79517
|
+
x: -((_a = this._spec.leftAppendPadding) !== null && _a !== void 0 ? _a : 0),
|
|
79379
79518
|
y: 0,
|
|
79380
79519
|
width: 10000,
|
|
79381
|
-
height: this._spec.clipHeight
|
|
79520
|
+
height: () => { var _a; return (_a = this._spec.clipHeight) !== null && _a !== void 0 ? _a : this._region.getLayoutRect().height; }
|
|
79382
79521
|
}, 'normal', AttributeLevel.Series);
|
|
79383
79522
|
clipMark.setMarkConfig({ interactive: false, clip: true });
|
|
79384
79523
|
}
|
|
@@ -97043,17 +97182,26 @@ const dataFilterWithNewDomain = (data, op) => {
|
|
|
97043
97182
|
return data.filter(filter);
|
|
97044
97183
|
};
|
|
97045
97184
|
const dataFilterComputeDomain = (data, op) => {
|
|
97046
|
-
const { stateFields, valueFields, dataCollection, isCategoryState } = op.input;
|
|
97185
|
+
const { stateFields, valueFields, dataCollection, isCategoryState, seriesCollection } = op.input;
|
|
97047
97186
|
const { stateField, valueField } = op.output;
|
|
97048
97187
|
const resultObj = {};
|
|
97188
|
+
const resultKeys = [];
|
|
97049
97189
|
const resultData = [];
|
|
97050
97190
|
const stateValues = [];
|
|
97051
97191
|
let hasLockDomain = false;
|
|
97192
|
+
let isAllLinearValue = false;
|
|
97052
97193
|
dataCollection.forEach((dv, i) => {
|
|
97053
97194
|
var _a;
|
|
97054
97195
|
if (isNil$1(stateFields[i])) {
|
|
97055
97196
|
return;
|
|
97056
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
|
+
}
|
|
97057
97205
|
const stateFieldInfo = (_a = dv.getFields()) === null || _a === void 0 ? void 0 : _a[stateFields[i]];
|
|
97058
97206
|
if (stateFieldInfo && stateFieldInfo.lockStatisticsByDomain) {
|
|
97059
97207
|
hasLockDomain = true;
|
|
@@ -97061,6 +97209,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97061
97209
|
if (isNil$1(resultObj[d])) {
|
|
97062
97210
|
stateValues.push(d);
|
|
97063
97211
|
resultObj[d] = 0;
|
|
97212
|
+
resultKeys.push(d);
|
|
97064
97213
|
}
|
|
97065
97214
|
});
|
|
97066
97215
|
}
|
|
@@ -97070,6 +97219,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97070
97219
|
if (isNil$1(resultObj[d[state]])) {
|
|
97071
97220
|
stateValues.push(d[state]);
|
|
97072
97221
|
resultObj[d[state]] = 0;
|
|
97222
|
+
resultKeys.push(d[state]);
|
|
97073
97223
|
}
|
|
97074
97224
|
if (!isNil$1(valueFields[i])) {
|
|
97075
97225
|
resultObj[d[state]] += isNaN(parseFloat(d[valueFields[i]])) ? 1 : parseFloat(d[valueFields[i]]);
|
|
@@ -97080,9 +97230,9 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97080
97230
|
});
|
|
97081
97231
|
const sortedStateValues = hasLockDomain
|
|
97082
97232
|
? stateValues
|
|
97083
|
-
: isCategoryState === false
|
|
97233
|
+
: isCategoryState === false || isAllLinearValue
|
|
97084
97234
|
? stateValues.sort((a, b) => a - b)
|
|
97085
|
-
:
|
|
97235
|
+
: resultKeys;
|
|
97086
97236
|
sortedStateValues.forEach(state => {
|
|
97087
97237
|
const res = { [stateField]: state };
|
|
97088
97238
|
if (valueField) {
|
|
@@ -97092,17 +97242,83 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97092
97242
|
});
|
|
97093
97243
|
return resultData;
|
|
97094
97244
|
};
|
|
97095
|
-
|
|
97096
|
-
|
|
97097
|
-
|
|
97098
|
-
|
|
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;
|
|
97099
97252
|
}
|
|
97100
|
-
|
|
97101
|
-
|
|
97102
|
-
|
|
97103
|
-
|
|
97104
|
-
|
|
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;
|
|
97105
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 };
|
|
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 {
|
|
97106
97322
|
enableInteraction() {
|
|
97107
97323
|
this._activeRoam = true;
|
|
97108
97324
|
}
|
|
@@ -97110,19 +97326,203 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97110
97326
|
this._activeRoam = false;
|
|
97111
97327
|
}
|
|
97112
97328
|
zoomIn(location) {
|
|
97113
|
-
this.
|
|
97329
|
+
this.handleChartZoom({
|
|
97114
97330
|
zoomDelta: 1.2,
|
|
97115
97331
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97116
97332
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97117
97333
|
});
|
|
97118
97334
|
}
|
|
97119
97335
|
zoomOut(location) {
|
|
97120
|
-
this.
|
|
97336
|
+
this.handleChartZoom({
|
|
97121
97337
|
zoomDelta: 0.8,
|
|
97122
97338
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97123
97339
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97124
97340
|
});
|
|
97125
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
|
+
}
|
|
97126
97526
|
_handleChange(start, end, updateComponent) {
|
|
97127
97527
|
var _a, _b;
|
|
97128
97528
|
const zoomLock = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.zoomLock) !== null && _b !== void 0 ? _b : false;
|
|
@@ -97136,18 +97536,10 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97136
97536
|
this._spanCache = end - start;
|
|
97137
97537
|
}
|
|
97138
97538
|
}
|
|
97139
|
-
_isReverse() {
|
|
97140
|
-
const axis = this._relatedAxisComponent;
|
|
97141
|
-
if (!axis) {
|
|
97142
|
-
return false;
|
|
97143
|
-
}
|
|
97144
|
-
const axisScale = axis.getScale();
|
|
97145
|
-
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || this._isHorizontal);
|
|
97146
|
-
}
|
|
97147
97539
|
_updateRangeFactor(tag) {
|
|
97148
97540
|
const axis = this._relatedAxisComponent;
|
|
97149
97541
|
const axisScale = axis.getScale();
|
|
97150
|
-
const reverse = this.
|
|
97542
|
+
const reverse = isReverse(axis, this._isHorizontal);
|
|
97151
97543
|
const newRangeFactor = reverse ? [1 - this._end, 1 - this._start] : [this._start, this._end];
|
|
97152
97544
|
if (reverse) {
|
|
97153
97545
|
switch (tag) {
|
|
@@ -97194,23 +97586,16 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97194
97586
|
this._orient = 'left';
|
|
97195
97587
|
this._cacheVisibility = undefined;
|
|
97196
97588
|
this._dataUpdating = false;
|
|
97589
|
+
this._hasInitStateScale = false;
|
|
97197
97590
|
this._shouldChange = true;
|
|
97198
97591
|
this._stateField = 'x';
|
|
97199
|
-
this.
|
|
97200
|
-
|
|
97201
|
-
|
|
97202
|
-
|
|
97203
|
-
|
|
97204
|
-
|
|
97205
|
-
|
|
97206
|
-
enable: true,
|
|
97207
|
-
rate: 1,
|
|
97208
|
-
reverse: true
|
|
97209
|
-
};
|
|
97210
|
-
this._scrollAttr = {
|
|
97211
|
-
enable: true,
|
|
97212
|
-
rate: 1,
|
|
97213
|
-
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;
|
|
97214
97599
|
};
|
|
97215
97600
|
this.effect = {
|
|
97216
97601
|
onZoomChange: (tag) => {
|
|
@@ -97219,7 +97604,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97219
97604
|
if (axis && this._filterMode === 'axis') {
|
|
97220
97605
|
const axisScale = axis.getScale();
|
|
97221
97606
|
const axisSpec = axis.getSpec();
|
|
97222
|
-
if (this._auto &&
|
|
97607
|
+
if (this._auto && getAxisBandSize(axisSpec) && this._spec.ignoreBandSize) {
|
|
97223
97608
|
axisScale.bandwidth('auto');
|
|
97224
97609
|
axisScale.maxBandwidth('auto');
|
|
97225
97610
|
axisScale.minBandwidth('auto');
|
|
@@ -97250,92 +97635,14 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97250
97635
|
}
|
|
97251
97636
|
};
|
|
97252
97637
|
this._visible = true;
|
|
97253
|
-
this._handleStateChange = (startValue, endValue, tag) => {
|
|
97254
|
-
var _a, _b;
|
|
97255
|
-
this._startValue = startValue;
|
|
97256
|
-
this._endValue = endValue;
|
|
97257
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97258
|
-
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
|
|
97259
|
-
return true;
|
|
97260
|
-
};
|
|
97261
|
-
this._handleChartZoom = (params, e) => {
|
|
97262
|
-
var _a, _b;
|
|
97263
|
-
if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
|
|
97264
|
-
return;
|
|
97265
|
-
}
|
|
97266
|
-
const { zoomDelta, zoomX, zoomY } = params;
|
|
97267
|
-
const { x, y } = this._regions[0].getLayoutStartPoint();
|
|
97268
|
-
const { width, height } = this._regions[0].getLayoutRect();
|
|
97269
|
-
const delta = Math.abs(this._start - this._end);
|
|
97270
|
-
const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
|
|
97271
|
-
if (delta >= 1 && zoomDelta < 1) {
|
|
97272
|
-
return;
|
|
97273
|
-
}
|
|
97274
|
-
if (delta <= 0.01 && zoomDelta > 1) {
|
|
97275
|
-
return;
|
|
97276
|
-
}
|
|
97277
|
-
const focusLoc = this._isHorizontal ? zoomX : zoomY;
|
|
97278
|
-
const totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
97279
|
-
let startValue = totalValue / 2;
|
|
97280
|
-
let endValue = totalValue / 2;
|
|
97281
|
-
if (focusLoc) {
|
|
97282
|
-
const startLoc = this._isHorizontal ? x : y;
|
|
97283
|
-
const endLoc = this._isHorizontal ? width : height;
|
|
97284
|
-
startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97285
|
-
endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97286
|
-
}
|
|
97287
|
-
const start = clamp$1(this._start + startValue, 0, 1);
|
|
97288
|
-
const end = clamp$1(this._end - endValue, 0, 1);
|
|
97289
|
-
this._handleChange(Math.min(start, end), Math.max(start, end), true);
|
|
97290
|
-
};
|
|
97291
|
-
this._handleChartScroll = (params, e) => {
|
|
97292
|
-
var _a;
|
|
97293
|
-
if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
|
|
97294
|
-
return false;
|
|
97295
|
-
}
|
|
97296
|
-
const { scrollX, scrollY } = params;
|
|
97297
|
-
let value = this._isHorizontal ? scrollX : scrollY;
|
|
97298
|
-
const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
|
|
97299
|
-
if (!this._scrollAttr.reverse) {
|
|
97300
|
-
value = -value;
|
|
97301
|
-
}
|
|
97302
|
-
if (active) {
|
|
97303
|
-
this._handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97304
|
-
}
|
|
97305
|
-
const hasChange = this._start !== 0 && this._end !== 1;
|
|
97306
|
-
return active && hasChange;
|
|
97307
|
-
};
|
|
97308
|
-
this._handleChartDrag = (delta, e) => {
|
|
97309
|
-
var _a, _b;
|
|
97310
|
-
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
97311
|
-
return;
|
|
97312
|
-
}
|
|
97313
|
-
if ((_a = this._spec.roamDrag) === null || _a === void 0 ? void 0 : _a.autoVisible) {
|
|
97314
|
-
this.show();
|
|
97315
|
-
}
|
|
97316
|
-
const [dx, dy] = delta;
|
|
97317
|
-
let value = this._isHorizontal ? dx : dy;
|
|
97318
|
-
if (this._dragAttr.reverse) {
|
|
97319
|
-
value = -value;
|
|
97320
|
-
}
|
|
97321
|
-
this._handleChartMove(value, (_b = this._dragAttr.rate) !== null && _b !== void 0 ? _b : 1);
|
|
97322
|
-
};
|
|
97323
|
-
this._handleChartMove = (value, rate) => {
|
|
97324
|
-
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
97325
|
-
if (Math.abs(value) >= 1e-6) {
|
|
97326
|
-
if (value > 0 && this._end < 1) {
|
|
97327
|
-
const moveDelta = Math.min(1 - this._end, value / totalValue) * rate;
|
|
97328
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97329
|
-
}
|
|
97330
|
-
else if (value < 0 && this._start > 0) {
|
|
97331
|
-
const moveDelta = Math.max(-this._start, value / totalValue) * rate;
|
|
97332
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97333
|
-
}
|
|
97334
|
-
}
|
|
97335
|
-
return false;
|
|
97336
|
-
};
|
|
97337
97638
|
this._orient = getOrient(spec);
|
|
97338
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);
|
|
97339
97646
|
}
|
|
97340
97647
|
created() {
|
|
97341
97648
|
super.created();
|
|
@@ -97350,6 +97657,88 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97350
97657
|
super.initLayout();
|
|
97351
97658
|
this._layout && (this._layout.layoutOrient = this._orient);
|
|
97352
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
|
+
}
|
|
97353
97742
|
_setAxisFromSpec() {
|
|
97354
97743
|
if (isValid$1(this._spec.axisId)) {
|
|
97355
97744
|
this._relatedAxisComponent = this._option.getComponentByUserId(this._spec.axisId);
|
|
@@ -97359,7 +97748,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97359
97748
|
}
|
|
97360
97749
|
if (isNil$1(this._spec.field) && !this._relatedAxisComponent) {
|
|
97361
97750
|
const axes = this._option.getComponentsByKey('axes');
|
|
97362
|
-
const sameOrientAxis = axes.find((cm) => cm._orient === this._orient);
|
|
97751
|
+
const sameOrientAxis = axes.find((cm) => getDirectionByOrient(cm._orient) === getDirectionByOrient(this._orient));
|
|
97363
97752
|
if (sameOrientAxis) {
|
|
97364
97753
|
this._relatedAxisComponent = sameOrientAxis;
|
|
97365
97754
|
}
|
|
@@ -97410,33 +97799,9 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97410
97799
|
}
|
|
97411
97800
|
return;
|
|
97412
97801
|
}
|
|
97413
|
-
onDataUpdate() {
|
|
97414
|
-
var _a;
|
|
97415
|
-
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
97416
|
-
this._stateScale.domain(domain, false);
|
|
97417
|
-
this._handleChange(this._start, this._end, true);
|
|
97418
|
-
if (this._spec.auto && !isEqual(this._domainCache, domain)) {
|
|
97419
|
-
this._domainCache = domain;
|
|
97420
|
-
this._dataUpdating = true;
|
|
97421
|
-
(_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
|
|
97422
|
-
}
|
|
97423
|
-
}
|
|
97424
|
-
_computeDomainOfStateScale(isContinuous) {
|
|
97425
|
-
if (this._spec.customDomain) {
|
|
97426
|
-
return this._spec.customDomain;
|
|
97427
|
-
}
|
|
97428
|
-
const domain = this._data.getLatestData().map((d) => d[this._stateField]);
|
|
97429
|
-
if (isContinuous) {
|
|
97430
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97431
|
-
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
|
|
97432
|
-
}
|
|
97433
|
-
return domain;
|
|
97434
|
-
}
|
|
97435
|
-
_initEvent() {
|
|
97436
|
-
this._initCommonEvent();
|
|
97437
|
-
}
|
|
97438
97802
|
_initData() {
|
|
97439
97803
|
const dataCollection = [];
|
|
97804
|
+
const seriesCollection = [];
|
|
97440
97805
|
const stateFields = [];
|
|
97441
97806
|
const valueFields = [];
|
|
97442
97807
|
let isCategoryState;
|
|
@@ -97465,6 +97830,8 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97465
97830
|
? xAxisHelper
|
|
97466
97831
|
: yAxisHelper;
|
|
97467
97832
|
const valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
|
|
97833
|
+
const isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type);
|
|
97834
|
+
const isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
|
|
97468
97835
|
dataCollection.push(s.getRawData());
|
|
97469
97836
|
const seriesSpec = s.getSpec();
|
|
97470
97837
|
const xField = s.coordinate === 'cartesian'
|
|
@@ -97475,16 +97842,17 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97475
97842
|
: array((_b = seriesSpec.radiusField) !== null && _b !== void 0 ? _b : seriesSpec.valueField);
|
|
97476
97843
|
originalStateFields[s.id] =
|
|
97477
97844
|
s.type === 'link' ? ['from_xField'] : stateAxisHelper === xAxisHelper ? xField : yField;
|
|
97478
|
-
if (
|
|
97845
|
+
if (isValidateStateAxis) {
|
|
97479
97846
|
isCategoryState = false;
|
|
97480
97847
|
stateFields.push(originalStateFields[s.id]);
|
|
97481
97848
|
}
|
|
97482
97849
|
else {
|
|
97850
|
+
isCategoryState = true;
|
|
97483
97851
|
stateFields.push(originalStateFields[s.id][0]);
|
|
97484
97852
|
}
|
|
97485
97853
|
if (this._valueField) {
|
|
97486
97854
|
const valueField = s.type === 'link' ? ['from_yField'] : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
97487
|
-
if (
|
|
97855
|
+
if (isValidateValueAxis) {
|
|
97488
97856
|
valueFields.push(...valueField);
|
|
97489
97857
|
}
|
|
97490
97858
|
}
|
|
@@ -97497,6 +97865,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97497
97865
|
else {
|
|
97498
97866
|
eachSeries(this._regions, s => {
|
|
97499
97867
|
dataCollection.push(s.getRawData());
|
|
97868
|
+
seriesCollection.push(s);
|
|
97500
97869
|
stateFields.push(this._field);
|
|
97501
97870
|
if (this._valueField) {
|
|
97502
97871
|
valueFields.push(this._spec.valueField);
|
|
@@ -97515,6 +97884,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97515
97884
|
options: {
|
|
97516
97885
|
input: {
|
|
97517
97886
|
dataCollection: dataCollection,
|
|
97887
|
+
seriesCollection,
|
|
97518
97888
|
stateFields,
|
|
97519
97889
|
valueFields,
|
|
97520
97890
|
isCategoryState
|
|
@@ -97529,136 +97899,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97529
97899
|
data.reRunAllTransform();
|
|
97530
97900
|
dataSet.multipleDataViewAddListener(dataCollection, 'change', this._handleDataCollectionChange.bind(this));
|
|
97531
97901
|
}
|
|
97532
|
-
setAttrFromSpec() {
|
|
97533
|
-
var _a;
|
|
97534
|
-
super.setAttrFromSpec();
|
|
97535
|
-
if (this._spec.roamZoom === true || this._spec.roamZoom) {
|
|
97536
|
-
this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
|
|
97537
|
-
}
|
|
97538
|
-
else {
|
|
97539
|
-
this._zoomAttr.enable = false;
|
|
97540
|
-
}
|
|
97541
|
-
if (this._spec.roamDrag === true || this._spec.roamDrag) {
|
|
97542
|
-
this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
|
|
97543
|
-
}
|
|
97544
|
-
else {
|
|
97545
|
-
this._dragAttr.enable = false;
|
|
97546
|
-
}
|
|
97547
|
-
if (this._spec.roamScroll === true || this._spec.roamScroll) {
|
|
97548
|
-
this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
|
|
97549
|
-
}
|
|
97550
|
-
else {
|
|
97551
|
-
this._scrollAttr.enable = false;
|
|
97552
|
-
}
|
|
97553
|
-
this._field = this._spec.field;
|
|
97554
|
-
this._width = this._computeWidth();
|
|
97555
|
-
this._height = this._computeHeight();
|
|
97556
|
-
this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
|
|
97557
|
-
}
|
|
97558
|
-
statePointToData(state) {
|
|
97559
|
-
const scale = this._stateScale;
|
|
97560
|
-
const domain = scale.domain();
|
|
97561
|
-
if (isContinuous(scale.type)) {
|
|
97562
|
-
if (this._isReverse()) {
|
|
97563
|
-
return domain[0] + (last(domain) - domain[0]) * (1 - state);
|
|
97564
|
-
}
|
|
97565
|
-
return domain[0] + (last(domain) - domain[0]) * state;
|
|
97566
|
-
}
|
|
97567
|
-
let range = scale.range();
|
|
97568
|
-
if (this._isReverse()) {
|
|
97569
|
-
range = range.slice().reverse();
|
|
97570
|
-
}
|
|
97571
|
-
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
97572
|
-
return scale.invert(posInRange);
|
|
97573
|
-
}
|
|
97574
|
-
dataToStatePoint(data) {
|
|
97575
|
-
const scale = this._stateScale;
|
|
97576
|
-
const pos = scale.scale(data);
|
|
97577
|
-
let range = scale.range();
|
|
97578
|
-
if (!this._isHorizontal && isContinuous(scale.type)) {
|
|
97579
|
-
range = range.slice().reverse();
|
|
97580
|
-
}
|
|
97581
|
-
return (pos - range[0]) / (last(range) - range[0]);
|
|
97582
|
-
}
|
|
97583
|
-
_modeCheck(statePoint, mode) {
|
|
97584
|
-
if (statePoint === 'start') {
|
|
97585
|
-
return (mode === 'percent' && isValid$1(this._spec.start)) || (mode === 'value' && isValid$1(this._spec.startValue));
|
|
97586
|
-
}
|
|
97587
|
-
return (mode === 'percent' && isValid$1(this._spec.end)) || (mode === 'value' && isValid$1(this._spec.endValue));
|
|
97588
|
-
}
|
|
97589
|
-
_setStateFromSpec() {
|
|
97590
|
-
var _a, _b;
|
|
97591
|
-
this._auto = !!this._spec.auto;
|
|
97592
|
-
let start;
|
|
97593
|
-
let end;
|
|
97594
|
-
if (this._spec.rangeMode) {
|
|
97595
|
-
const [startMode, endMode] = this._spec.rangeMode;
|
|
97596
|
-
if (this._modeCheck('start', startMode) && this._modeCheck('end', endMode)) {
|
|
97597
|
-
start = startMode === 'percent' ? this._spec.start : this.dataToStatePoint(this._spec.startValue);
|
|
97598
|
-
end = endMode === 'percent' ? this._spec.end : this.dataToStatePoint(this._spec.endValue);
|
|
97599
|
-
}
|
|
97600
|
-
}
|
|
97601
|
-
else {
|
|
97602
|
-
start = this._spec.start
|
|
97603
|
-
? this._spec.start
|
|
97604
|
-
: this._spec.startValue
|
|
97605
|
-
? this.dataToStatePoint(this._spec.startValue)
|
|
97606
|
-
: 0;
|
|
97607
|
-
end = this._spec.end ? this._spec.end : this._spec.endValue ? this.dataToStatePoint(this._spec.endValue) : 1;
|
|
97608
|
-
}
|
|
97609
|
-
this._startValue = this.statePointToData(start);
|
|
97610
|
-
this._endValue = this.statePointToData(end);
|
|
97611
|
-
this._start = start;
|
|
97612
|
-
this._end = end;
|
|
97613
|
-
this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
|
|
97614
|
-
this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
|
|
97615
|
-
if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
|
|
97616
|
-
if (this._spec.minValueSpan) {
|
|
97617
|
-
this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97618
|
-
}
|
|
97619
|
-
if (this._spec.maxValueSpan) {
|
|
97620
|
-
this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97621
|
-
}
|
|
97622
|
-
}
|
|
97623
|
-
this._minSpan = Math.max(0, this._minSpan);
|
|
97624
|
-
this._maxSpan = Math.min(this._maxSpan, 1);
|
|
97625
|
-
if ((!this._relatedAxisComponent || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
|
|
97626
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97627
|
-
}
|
|
97628
|
-
}
|
|
97629
|
-
_parseFieldOfSeries(s) {
|
|
97630
|
-
var _a;
|
|
97631
|
-
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97632
|
-
}
|
|
97633
|
-
_initStateScale() {
|
|
97634
|
-
const defaultRange = [0, 1];
|
|
97635
|
-
if (this._relatedAxisComponent) {
|
|
97636
|
-
const scale = this._relatedAxisComponent.getScale();
|
|
97637
|
-
const isContinuousScale = isContinuous(scale.type);
|
|
97638
|
-
const domain = this._computeDomainOfStateScale(isContinuousScale);
|
|
97639
|
-
this._stateScale = scale.clone();
|
|
97640
|
-
if (isContinuousScale) {
|
|
97641
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97642
|
-
this._stateScale
|
|
97643
|
-
.domain(domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [0, 1], true)
|
|
97644
|
-
.range(defaultRange);
|
|
97645
|
-
}
|
|
97646
|
-
else {
|
|
97647
|
-
this._stateScale.domain(domain, true).range(defaultRange);
|
|
97648
|
-
}
|
|
97649
|
-
}
|
|
97650
|
-
else {
|
|
97651
|
-
this._stateScale = new BandScale();
|
|
97652
|
-
this._stateScale.domain(this._computeDomainOfStateScale(), true).range(defaultRange);
|
|
97653
|
-
}
|
|
97654
|
-
}
|
|
97655
|
-
init(option) {
|
|
97656
|
-
super.init(option);
|
|
97657
|
-
this._addTransformToSeries();
|
|
97658
|
-
if (this._start !== 0 || this._end !== 1) {
|
|
97659
|
-
this.effect.onZoomChange();
|
|
97660
|
-
}
|
|
97661
|
-
}
|
|
97662
97902
|
_addTransformToSeries() {
|
|
97663
97903
|
if (!this._relatedAxisComponent || this._filterMode !== 'axis') {
|
|
97664
97904
|
registerDataSetInstanceTransform(this._option.dataSet, 'dataFilterWithNewDomain', dataFilterWithNewDomain);
|
|
@@ -97697,59 +97937,116 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97697
97937
|
});
|
|
97698
97938
|
}
|
|
97699
97939
|
}
|
|
97700
|
-
|
|
97701
|
-
|
|
97702
|
-
|
|
97703
|
-
|
|
97704
|
-
|
|
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);
|
|
97705
97949
|
}
|
|
97706
|
-
return result;
|
|
97707
97950
|
}
|
|
97708
|
-
|
|
97709
|
-
|
|
97710
|
-
this.
|
|
97711
|
-
g.getMarks().forEach(m => {
|
|
97712
|
-
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
97713
|
-
});
|
|
97714
|
-
});
|
|
97951
|
+
_parseFieldOfSeries(s) {
|
|
97952
|
+
var _a;
|
|
97953
|
+
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97715
97954
|
}
|
|
97716
|
-
|
|
97717
|
-
|
|
97718
|
-
|
|
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;
|
|
97719
97983
|
}
|
|
97720
|
-
|
|
97721
|
-
|
|
97722
|
-
const endIndex = allDomain.indexOf(endValue);
|
|
97723
|
-
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));
|
|
97724
97986
|
}
|
|
97725
|
-
|
|
97726
|
-
var _a, _b
|
|
97727
|
-
|
|
97728
|
-
const
|
|
97729
|
-
|
|
97730
|
-
|
|
97731
|
-
|
|
97732
|
-
|
|
97733
|
-
|
|
97734
|
-
|
|
97735
|
-
|
|
97736
|
-
|
|
97737
|
-
|
|
97738
|
-
|
|
97739
|
-
|
|
97740
|
-
|
|
97741
|
-
|
|
97742
|
-
|
|
97743
|
-
|
|
97744
|
-
|
|
97745
|
-
|
|
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);
|
|
97746
98010
|
}
|
|
97747
98011
|
}
|
|
97748
|
-
|
|
97749
|
-
|
|
97750
|
-
|
|
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);
|
|
98022
|
+
}
|
|
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);
|
|
97751
98038
|
}
|
|
97752
|
-
|
|
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;
|
|
97753
98050
|
}
|
|
97754
98051
|
_autoVisible(isShown) {
|
|
97755
98052
|
if (!this._auto) {
|
|
@@ -97768,29 +98065,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97768
98065
|
[sizeKey]: AttributeLevel.Built_In
|
|
97769
98066
|
});
|
|
97770
98067
|
}
|
|
97771
|
-
onLayoutStart(layoutRect, viewRect) {
|
|
97772
|
-
super.onLayoutStart(layoutRect, viewRect);
|
|
97773
|
-
const isShown = this._autoUpdate(layoutRect);
|
|
97774
|
-
this._autoVisible(isShown);
|
|
97775
|
-
this._dataUpdating = false;
|
|
97776
|
-
}
|
|
97777
|
-
onLayoutEnd() {
|
|
97778
|
-
const isShown = !(this._start === 0 && this._end === 1);
|
|
97779
|
-
this._autoVisible(isShown);
|
|
97780
|
-
super.onLayoutEnd();
|
|
97781
|
-
}
|
|
97782
|
-
getBoundsInRect(rect) {
|
|
97783
|
-
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
97784
|
-
if (this._isHorizontal) {
|
|
97785
|
-
result.y2 = result.y1 + this._height;
|
|
97786
|
-
result.x2 = result.x1 + rect.width;
|
|
97787
|
-
}
|
|
97788
|
-
else {
|
|
97789
|
-
result.x2 = result.x1 + this._width;
|
|
97790
|
-
result.y2 = result.y1 + rect.height;
|
|
97791
|
-
}
|
|
97792
|
-
return result;
|
|
97793
|
-
}
|
|
97794
98068
|
hide() {
|
|
97795
98069
|
var _a;
|
|
97796
98070
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.hideAll();
|
|
@@ -97799,15 +98073,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97799
98073
|
var _a;
|
|
97800
98074
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.showAll();
|
|
97801
98075
|
}
|
|
97802
|
-
_getAxisBandSize(axisSpec) {
|
|
97803
|
-
const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
|
|
97804
|
-
const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
|
|
97805
|
-
const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
|
|
97806
|
-
if (bandSize || minBandSize || maxBandSize) {
|
|
97807
|
-
return { bandSize, maxBandSize, minBandSize };
|
|
97808
|
-
}
|
|
97809
|
-
return undefined;
|
|
97810
|
-
}
|
|
97811
98076
|
_autoUpdate(rect) {
|
|
97812
98077
|
var _a, _b, _c, _d, _e, _f;
|
|
97813
98078
|
if (!this._auto) {
|
|
@@ -97817,7 +98082,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97817
98082
|
const axis = this._relatedAxisComponent;
|
|
97818
98083
|
const axisSpec = axis === null || axis === void 0 ? void 0 : axis.getSpec();
|
|
97819
98084
|
const axisScale = axis === null || axis === void 0 ? void 0 : axis.getScale();
|
|
97820
|
-
const bandSizeResult =
|
|
98085
|
+
const bandSizeResult = getAxisBandSize(axisSpec);
|
|
97821
98086
|
if (!this._dataUpdating &&
|
|
97822
98087
|
isDiscrete(axisScale.type) &&
|
|
97823
98088
|
(rect === null || rect === void 0 ? void 0 : rect.height) === ((_a = this._cacheRect) === null || _a === void 0 ? void 0 : _a.height) &&
|
|
@@ -97864,9 +98129,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97864
98129
|
_getNeedClearVRenderComponents() {
|
|
97865
98130
|
return [this._component];
|
|
97866
98131
|
}
|
|
97867
|
-
clear() {
|
|
97868
|
-
this._throttledHide = null;
|
|
97869
|
-
}
|
|
97870
98132
|
}
|
|
97871
98133
|
mixin(DataFilterBaseComponent, Zoomable);
|
|
97872
98134
|
|
|
@@ -98012,14 +98274,14 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98012
98274
|
this.layoutType = 'region-relative';
|
|
98013
98275
|
this._isReverseCache = false;
|
|
98014
98276
|
this._dataToPositionX = (datum) => {
|
|
98015
|
-
const offsetLeft = this.
|
|
98277
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98016
98278
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98017
98279
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98018
98280
|
const xField = this._isHorizontal ? this._stateField : this._valueField;
|
|
98019
98281
|
return xScale.scale(datum[xField]) + this.getLayoutStartPoint().x + offsetLeft + offsetHandler;
|
|
98020
98282
|
};
|
|
98021
98283
|
this._dataToPositionX2 = (datum) => {
|
|
98022
|
-
const offsetLeft = this.
|
|
98284
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98023
98285
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98024
98286
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98025
98287
|
const min = xScale.domain()[0];
|
|
@@ -98028,63 +98290,146 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98028
98290
|
this._dataToPositionY = (datum) => {
|
|
98029
98291
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98030
98292
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98031
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98293
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98032
98294
|
const yField = this._isHorizontal ? this._valueField : this._stateField;
|
|
98033
98295
|
return yScale.scale(datum[yField]) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98034
98296
|
};
|
|
98035
98297
|
this._dataToPositionY2 = (datum) => {
|
|
98036
98298
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98037
98299
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98038
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98300
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98039
98301
|
const min = yScale.domain()[0];
|
|
98040
98302
|
return yScale.scale(min) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98041
98303
|
};
|
|
98042
98304
|
this._valueField = 'y';
|
|
98043
98305
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'filter';
|
|
98044
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
|
+
}
|
|
98045
98356
|
created() {
|
|
98046
98357
|
super.created();
|
|
98047
98358
|
this._initValueScale();
|
|
98048
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
|
+
}
|
|
98049
98411
|
setAttrFromSpec() {
|
|
98050
98412
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
98051
98413
|
super.setAttrFromSpec();
|
|
98052
|
-
|
|
98053
|
-
this._zoomAttr.enable = this._spec.roam;
|
|
98054
|
-
this._dragAttr.enable = this._spec.roam;
|
|
98055
|
-
this._scrollAttr.enable = this._spec.roam;
|
|
98056
|
-
}
|
|
98057
|
-
if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
|
|
98058
|
-
this.initZoomable(this.event, this._option.mode);
|
|
98059
|
-
}
|
|
98414
|
+
const componentSize = this._isHorizontal ? Number(this._spec.height) : Number(this._spec.width);
|
|
98060
98415
|
this._backgroundSize = (_b = (_a = this._spec.background) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 30;
|
|
98061
98416
|
this._middleHandlerSize = this._computeMiddleHandlerSize();
|
|
98062
|
-
this._width = this._computeWidth();
|
|
98063
|
-
this._height = this._computeHeight();
|
|
98064
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)) {
|
|
98065
|
-
this._spec.startHandler.style.size =
|
|
98066
|
-
? this.
|
|
98067
|
-
:
|
|
98418
|
+
this._spec.startHandler.style.size = isNaN(componentSize)
|
|
98419
|
+
? this._backgroundSize
|
|
98420
|
+
: componentSize - this._middleHandlerSize;
|
|
98068
98421
|
}
|
|
98069
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)) {
|
|
98070
|
-
this._spec.endHandler.style.size =
|
|
98071
|
-
? this.
|
|
98072
|
-
:
|
|
98073
|
-
}
|
|
98074
|
-
const
|
|
98075
|
-
const
|
|
98076
|
-
this._startHandlerSize =
|
|
98077
|
-
this._endHandlerSize =
|
|
98078
|
-
|
|
98079
|
-
|
|
98080
|
-
this._updateScaleRange();
|
|
98081
|
-
if (this._isReverse() && !this._isReverseCache) {
|
|
98082
|
-
this._isReverseCache = this._isReverse();
|
|
98083
|
-
this.effect.onZoomChange();
|
|
98084
|
-
}
|
|
98085
|
-
if (this._cacheVisibility !== false) {
|
|
98086
|
-
super.onLayoutEnd();
|
|
98087
|
-
}
|
|
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();
|
|
98088
98433
|
}
|
|
98089
98434
|
_initValueScale() {
|
|
98090
98435
|
const domain = this._computeDomainOfValueScale();
|
|
@@ -98095,9 +98440,13 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98095
98440
|
}
|
|
98096
98441
|
}
|
|
98097
98442
|
_updateScaleRange() {
|
|
98098
|
-
|
|
98443
|
+
this._updateStateScaleRange();
|
|
98444
|
+
this._updateValueScaleRange();
|
|
98445
|
+
}
|
|
98446
|
+
_updateStateScaleRange() {
|
|
98447
|
+
var _a, _b, _c;
|
|
98099
98448
|
const handlerSize = this._startHandlerSize + this._endHandlerSize;
|
|
98100
|
-
if (!this._stateScale
|
|
98449
|
+
if (!this._stateScale) {
|
|
98101
98450
|
return;
|
|
98102
98451
|
}
|
|
98103
98452
|
let stateScaleRange;
|
|
@@ -98114,14 +98463,27 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98114
98463
|
stateScaleRange = this._visible
|
|
98115
98464
|
? [this._startHandlerSize / 2, compWidth - handlerSize + this._startHandlerSize / 2]
|
|
98116
98465
|
: defaultRange;
|
|
98117
|
-
this._stateScale.range(stateScaleRange);
|
|
98118
|
-
this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
|
|
98119
98466
|
}
|
|
98120
98467
|
else {
|
|
98121
98468
|
stateScaleRange = this._visible
|
|
98122
98469
|
? [this._startHandlerSize / 2, compHeight - handlerSize + this._startHandlerSize / 2]
|
|
98123
98470
|
: defaultRange;
|
|
98124
|
-
|
|
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 {
|
|
98125
98487
|
if (this.layoutOrient === 'left') {
|
|
98126
98488
|
this._valueScale.range([compWidth - this._middleHandlerSize, 0]);
|
|
98127
98489
|
}
|
|
@@ -98129,24 +98491,35 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98129
98491
|
this._valueScale.range([0, compWidth - this._middleHandlerSize]);
|
|
98130
98492
|
}
|
|
98131
98493
|
}
|
|
98132
|
-
if (this._component && this._cacheVisibility !== false) {
|
|
98133
|
-
this._component.setAttributes({
|
|
98134
|
-
size: {
|
|
98135
|
-
width: compWidth,
|
|
98136
|
-
height: compHeight
|
|
98137
|
-
},
|
|
98138
|
-
position: {
|
|
98139
|
-
x: this.getLayoutStartPoint().x,
|
|
98140
|
-
y: this.getLayoutStartPoint().y
|
|
98141
|
-
}
|
|
98142
|
-
});
|
|
98143
|
-
}
|
|
98144
98494
|
}
|
|
98145
98495
|
_computeDomainOfValueScale() {
|
|
98146
98496
|
const domain = this._data.getLatestData().map((d) => d[this._valueField]);
|
|
98147
98497
|
const domainNum = domain.map((n) => n * 1);
|
|
98148
98498
|
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : null;
|
|
98149
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
|
+
}
|
|
98150
98523
|
_computeMiddleHandlerSize() {
|
|
98151
98524
|
var _a, _b, _c, _d;
|
|
98152
98525
|
let size = 0;
|
|
@@ -98167,7 +98540,8 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98167
98540
|
if (this._isHorizontal) {
|
|
98168
98541
|
return this.getLayoutRect().width;
|
|
98169
98542
|
}
|
|
98170
|
-
return this.
|
|
98543
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98544
|
+
this._middleHandlerSize);
|
|
98171
98545
|
}
|
|
98172
98546
|
_computeHeight() {
|
|
98173
98547
|
if (this._visible === false) {
|
|
@@ -98177,23 +98551,11 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98177
98551
|
return this._spec.height;
|
|
98178
98552
|
}
|
|
98179
98553
|
if (this._isHorizontal) {
|
|
98180
|
-
return this.
|
|
98554
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98555
|
+
this._middleHandlerSize);
|
|
98181
98556
|
}
|
|
98182
98557
|
return this.getLayoutRect().height;
|
|
98183
98558
|
}
|
|
98184
|
-
_isScaleValid(scale) {
|
|
98185
|
-
if (!scale || !scale.domain()) {
|
|
98186
|
-
return false;
|
|
98187
|
-
}
|
|
98188
|
-
const domain = scale.domain();
|
|
98189
|
-
if (isContinuous(scale.type) && domain[0] === last(domain)) {
|
|
98190
|
-
return false;
|
|
98191
|
-
}
|
|
98192
|
-
if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
|
|
98193
|
-
return false;
|
|
98194
|
-
}
|
|
98195
|
-
return true;
|
|
98196
|
-
}
|
|
98197
98559
|
_getAttrs(isNeedPreview) {
|
|
98198
98560
|
var _a, _b, _c, _d, _e;
|
|
98199
98561
|
const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : {};
|
|
@@ -98203,73 +98565,58 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98203
98565
|
}, orient: this._orient, size: {
|
|
98204
98566
|
width: this._computeWidth(),
|
|
98205
98567
|
height: this._computeHeight()
|
|
98206
|
-
}, 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));
|
|
98207
98569
|
}
|
|
98208
|
-
|
|
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) {
|
|
98209
98583
|
if (this._visible) {
|
|
98210
98584
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98211
98585
|
const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
|
|
98212
98586
|
const isNeedPreview = this._isScaleValid(xScale) && this._isScaleValid(yScale) && this._spec.showBackgroundChart !== false;
|
|
98213
98587
|
const attrs = this._getAttrs(isNeedPreview);
|
|
98588
|
+
const axis = this._relatedAxisComponent;
|
|
98214
98589
|
if (this._component) {
|
|
98215
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
|
+
}
|
|
98216
98603
|
}
|
|
98217
98604
|
else {
|
|
98218
98605
|
const container = this.getContainer();
|
|
98219
98606
|
this._component = new DataZoom$1(attrs);
|
|
98607
|
+
this._component.setPreviewData(this._data.getDataView().latestData);
|
|
98220
98608
|
if (this._isHorizontal) {
|
|
98221
98609
|
isNeedPreview && this._component.setPreviewPointsY1(this._dataToPositionY2);
|
|
98222
98610
|
}
|
|
98223
98611
|
else {
|
|
98224
98612
|
isNeedPreview && this._component.setPreviewPointsX1(this._dataToPositionX2);
|
|
98225
98613
|
}
|
|
98226
|
-
this._component.setStatePointToData((state) => this.
|
|
98227
|
-
this._component.addEventListener('
|
|
98614
|
+
this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
|
|
98615
|
+
this._component.addEventListener('dataZoomChange', (e) => {
|
|
98228
98616
|
const { start, end, tag } = e.detail;
|
|
98229
98617
|
this._handleChange(start, end, undefined, tag);
|
|
98230
98618
|
});
|
|
98231
98619
|
container.add(this._component);
|
|
98232
|
-
this._updateScaleRange();
|
|
98233
|
-
}
|
|
98234
|
-
}
|
|
98235
|
-
}
|
|
98236
|
-
_handleChange(start, end, updateComponent, tag) {
|
|
98237
|
-
super._handleChange(start, end, updateComponent);
|
|
98238
|
-
if (this._shouldChange) {
|
|
98239
|
-
if (updateComponent && this._component) {
|
|
98240
|
-
this._component.setStartAndEnd(start, end);
|
|
98241
|
-
}
|
|
98242
|
-
this._start = start;
|
|
98243
|
-
this._end = end;
|
|
98244
|
-
const startValue = this.statePointToData(start);
|
|
98245
|
-
const endValue = this.statePointToData(end);
|
|
98246
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98247
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98248
|
-
: this._handleStateChange(startValue, endValue, tag);
|
|
98249
|
-
if (hasChange) {
|
|
98250
|
-
this.event.emit(ChartEvent.dataZoomChange, {
|
|
98251
|
-
model: this,
|
|
98252
|
-
value: {
|
|
98253
|
-
filterData: this._filterMode !== 'axis',
|
|
98254
|
-
start,
|
|
98255
|
-
end,
|
|
98256
|
-
startValue: this._startValue,
|
|
98257
|
-
endValue: this._endValue,
|
|
98258
|
-
newDomain: this._newDomain
|
|
98259
|
-
}
|
|
98260
|
-
});
|
|
98261
|
-
}
|
|
98262
|
-
}
|
|
98263
|
-
}
|
|
98264
|
-
_handleDataCollectionChange() {
|
|
98265
|
-
var _a;
|
|
98266
|
-
const data = this._data.getDataView();
|
|
98267
|
-
data.reRunAllTransform();
|
|
98268
|
-
(_a = this._component) === null || _a === void 0 ? void 0 : _a.setPreviewData(data.latestData);
|
|
98269
|
-
if (this._valueScale) {
|
|
98270
|
-
const domain = this._computeDomainOfValueScale();
|
|
98271
|
-
if (domain) {
|
|
98272
|
-
this._valueScale.domain(domain);
|
|
98273
98620
|
}
|
|
98274
98621
|
}
|
|
98275
98622
|
}
|
|
@@ -98331,16 +98678,23 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98331
98678
|
_getNeedClearVRenderComponents() {
|
|
98332
98679
|
return [this._component];
|
|
98333
98680
|
}
|
|
98334
|
-
|
|
98335
|
-
|
|
98336
|
-
|
|
98337
|
-
this.
|
|
98338
|
-
|
|
98339
|
-
|
|
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;
|
|
98340
98695
|
}
|
|
98341
|
-
this._component = null;
|
|
98342
98696
|
}
|
|
98343
|
-
|
|
98697
|
+
return this._previewStateScale;
|
|
98344
98698
|
}
|
|
98345
98699
|
}
|
|
98346
98700
|
DataZoom.type = ComponentTypeEnum.dataZoom;
|
|
@@ -98385,24 +98739,53 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98385
98739
|
this.layoutType = 'region-relative';
|
|
98386
98740
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'axis';
|
|
98387
98741
|
}
|
|
98388
|
-
|
|
98389
|
-
super.
|
|
98390
|
-
|
|
98391
|
-
|
|
98392
|
-
|
|
98393
|
-
|
|
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
|
+
}
|
|
98394
98769
|
}
|
|
98395
|
-
|
|
98396
|
-
|
|
98770
|
+
}
|
|
98771
|
+
_handleDataCollectionChange() {
|
|
98772
|
+
if (this._spec.auto) {
|
|
98773
|
+
const data = this._data.getDataView();
|
|
98774
|
+
data.reRunAllTransform();
|
|
98397
98775
|
}
|
|
98398
98776
|
}
|
|
98399
|
-
|
|
98777
|
+
_beforeLayoutEnd() {
|
|
98400
98778
|
var _a, _b;
|
|
98401
|
-
|
|
98779
|
+
super._beforeLayoutEnd();
|
|
98402
98780
|
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
98781
|
+
}
|
|
98782
|
+
onLayoutEnd() {
|
|
98783
|
+
this._updateComponentBounds();
|
|
98403
98784
|
super.onLayoutEnd();
|
|
98404
98785
|
}
|
|
98405
98786
|
_updateScaleRange() {
|
|
98787
|
+
}
|
|
98788
|
+
_updateComponentBounds() {
|
|
98406
98789
|
if (this._component) {
|
|
98407
98790
|
this._component.setAttributes({
|
|
98408
98791
|
x: this.getLayoutStartPoint().x,
|
|
@@ -98413,6 +98796,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98413
98796
|
}
|
|
98414
98797
|
}
|
|
98415
98798
|
_computeWidth() {
|
|
98799
|
+
if (this._visible === false) {
|
|
98800
|
+
return 0;
|
|
98801
|
+
}
|
|
98416
98802
|
if (isNumber$1(this._spec.width)) {
|
|
98417
98803
|
return this._spec.width;
|
|
98418
98804
|
}
|
|
@@ -98422,6 +98808,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98422
98808
|
return SCROLL_BAR_DEFAULT_SIZE;
|
|
98423
98809
|
}
|
|
98424
98810
|
_computeHeight() {
|
|
98811
|
+
if (this._visible === false) {
|
|
98812
|
+
return 0;
|
|
98813
|
+
}
|
|
98425
98814
|
if (isNumber$1(this._spec.height)) {
|
|
98426
98815
|
return this._spec.height;
|
|
98427
98816
|
}
|
|
@@ -98432,7 +98821,7 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98432
98821
|
}
|
|
98433
98822
|
_getAttrs() {
|
|
98434
98823
|
var _a, _b, _c, _d, _e, _f;
|
|
98435
|
-
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());
|
|
98436
98825
|
}
|
|
98437
98826
|
_createOrUpdateComponent() {
|
|
98438
98827
|
const attrs = this._getAttrs();
|
|
@@ -98453,41 +98842,6 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98453
98842
|
container.add(this._component);
|
|
98454
98843
|
}
|
|
98455
98844
|
}
|
|
98456
|
-
_handleChange(start, end, updateComponent) {
|
|
98457
|
-
super._handleChange(start, end, updateComponent);
|
|
98458
|
-
const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
|
|
98459
|
-
if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
|
|
98460
|
-
if (updateComponent && this._component) {
|
|
98461
|
-
this._component.setAttribute('range', [start, end]);
|
|
98462
|
-
}
|
|
98463
|
-
this._start = start;
|
|
98464
|
-
this._end = end;
|
|
98465
|
-
const startValue = this.statePointToData(start);
|
|
98466
|
-
const endValue = this.statePointToData(end);
|
|
98467
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98468
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98469
|
-
: this._handleStateChange(this.statePointToData(start), this.statePointToData(end));
|
|
98470
|
-
if (hasChange) {
|
|
98471
|
-
this.event.emit(ChartEvent.scrollBarChange, {
|
|
98472
|
-
model: this,
|
|
98473
|
-
value: {
|
|
98474
|
-
filterData: this._filterMode !== 'axis',
|
|
98475
|
-
start: this._start,
|
|
98476
|
-
end: this._end,
|
|
98477
|
-
startValue: this._startValue,
|
|
98478
|
-
endValue: this._endValue,
|
|
98479
|
-
newDomain: this._newDomain
|
|
98480
|
-
}
|
|
98481
|
-
});
|
|
98482
|
-
}
|
|
98483
|
-
}
|
|
98484
|
-
}
|
|
98485
|
-
_handleDataCollectionChange() {
|
|
98486
|
-
if (this._spec.auto) {
|
|
98487
|
-
const data = this._data.getDataView();
|
|
98488
|
-
data.reRunAllTransform();
|
|
98489
|
-
}
|
|
98490
|
-
}
|
|
98491
98845
|
_getComponentAttrs() {
|
|
98492
98846
|
const { rail, slider, innerPadding } = this._spec;
|
|
98493
98847
|
const attrs = {};
|
|
@@ -98844,7 +99198,7 @@ function xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries,
|
|
|
98844
99198
|
const lines = [];
|
|
98845
99199
|
const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
|
|
98846
99200
|
const xAxisHelper = relativeSeries.getXAxisHelper();
|
|
98847
|
-
const yAxisHelper = relativeSeries.
|
|
99201
|
+
const yAxisHelper = relativeSeries.getYAxisHelper();
|
|
98848
99202
|
const xDomain = xAxisHelper.getScale(0).domain();
|
|
98849
99203
|
const yDomain = yAxisHelper.getScale(0).domain();
|
|
98850
99204
|
const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
|
|
@@ -102623,17 +102977,13 @@ class Brush extends BaseComponent {
|
|
|
102623
102977
|
const axisRangeExpand = (_a = this._spec.axisRangeExpand) !== null && _a !== void 0 ? _a : 0;
|
|
102624
102978
|
const { x1, x2, y1, y2 } = operateMaskBounds;
|
|
102625
102979
|
const regionStartAttr = isHorizontal ? 'x' : 'y';
|
|
102980
|
+
const regionSizeAttr = isHorizontal ? 'width' : 'height';
|
|
102626
102981
|
const boundsStart = isHorizontal ? x1 : y1;
|
|
102627
102982
|
const boundsEnd = isHorizontal ? x2 : y2;
|
|
102628
102983
|
if (this._axisDataZoomMap[axis.id]) {
|
|
102629
102984
|
const dataZoom = this._axisDataZoomMap[axis.id];
|
|
102630
|
-
const
|
|
102631
|
-
const
|
|
102632
|
-
.getScale()
|
|
102633
|
-
.invert(boundsStart - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102634
|
-
const endValue = releatedAxis.getScale().invert(boundsEnd - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102635
|
-
const startPercent = dataZoom.dataToStatePoint(startValue);
|
|
102636
|
-
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];
|
|
102637
102987
|
const newStartPercent = this._stateClamp(startPercent - axisRangeExpand);
|
|
102638
102988
|
const newEndPercent = this._stateClamp(endPercent + axisRangeExpand);
|
|
102639
102989
|
dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), [
|
|
@@ -102644,8 +102994,8 @@ class Brush extends BaseComponent {
|
|
|
102644
102994
|
operateComponent: dataZoom,
|
|
102645
102995
|
start: newStartPercent,
|
|
102646
102996
|
end: newEndPercent,
|
|
102647
|
-
startValue: dataZoom.
|
|
102648
|
-
endValue: dataZoom.
|
|
102997
|
+
startValue: statePointToData(newStartPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal)),
|
|
102998
|
+
endValue: statePointToData(newEndPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal))
|
|
102649
102999
|
});
|
|
102650
103000
|
}
|
|
102651
103001
|
else {
|