@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.
Files changed (144) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +908 -558
  3. package/build/index.js +908 -558
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/config.d.ts +1 -0
  7. package/cjs/animation/config.js +13 -1
  8. package/cjs/animation/config.js.map +1 -1
  9. package/cjs/compile/compiler.d.ts +5 -0
  10. package/cjs/compile/compiler.js +42 -4
  11. package/cjs/compile/compiler.js.map +1 -1
  12. package/cjs/compile/interface/compilable-item.d.ts +2 -0
  13. package/cjs/compile/interface/compilable-item.js.map +1 -1
  14. package/cjs/component/axis/base-axis.d.ts +1 -1
  15. package/cjs/component/axis/base-axis.js +1 -1
  16. package/cjs/component/axis/base-axis.js.map +1 -1
  17. package/cjs/component/axis/cartesian/axis.d.ts +1 -1
  18. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  19. package/cjs/component/axis/cartesian/band-axis.d.ts +1 -1
  20. package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
  21. package/cjs/component/axis/interface/common.d.ts +1 -0
  22. package/cjs/component/axis/interface/common.js.map +1 -1
  23. package/cjs/component/axis/mixin/band-axis-mixin.d.ts +2 -0
  24. package/cjs/component/axis/mixin/band-axis-mixin.js +10 -4
  25. package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
  26. package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
  27. package/cjs/component/axis/mixin/linear-axis-mixin.js +15 -1
  28. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  29. package/cjs/component/axis/polar/axis.d.ts +1 -1
  30. package/cjs/component/axis/polar/axis.js.map +1 -1
  31. package/cjs/component/axis/polar/band-axis.d.ts +1 -1
  32. package/cjs/component/axis/polar/band-axis.js.map +1 -1
  33. package/cjs/component/brush/brush.js +6 -5
  34. package/cjs/component/brush/brush.js.map +1 -1
  35. package/cjs/component/data-zoom/data-filter-base-component.d.ts +31 -52
  36. package/cjs/component/data-zoom/data-filter-base-component.js +164 -240
  37. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  38. package/cjs/component/data-zoom/data-filter-event.d.ts +53 -0
  39. package/cjs/component/data-zoom/data-filter-event.js +112 -0
  40. package/cjs/component/data-zoom/data-filter-event.js.map +1 -0
  41. package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
  42. package/cjs/component/data-zoom/data-zoom/data-zoom.js +129 -84
  43. package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  44. package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
  45. package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +35 -36
  46. package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
  47. package/cjs/component/data-zoom/util.d.ts +14 -0
  48. package/cjs/component/data-zoom/util.js +81 -7
  49. package/cjs/component/data-zoom/util.js.map +1 -1
  50. package/cjs/component/marker/utils.js +1 -1
  51. package/cjs/component/marker/utils.js.map +1 -1
  52. package/cjs/constant/event.d.ts +1 -0
  53. package/cjs/constant/event.js +8 -8
  54. package/cjs/constant/event.js.map +1 -1
  55. package/cjs/core/index.d.ts +1 -1
  56. package/cjs/core/index.js +1 -1
  57. package/cjs/core/index.js.map +1 -1
  58. package/cjs/mark/base/base-mark.d.ts +2 -1
  59. package/cjs/mark/base/base-mark.js +7 -3
  60. package/cjs/mark/base/base-mark.js.map +1 -1
  61. package/cjs/mark/interface/common.d.ts +1 -0
  62. package/cjs/mark/interface/common.js.map +1 -1
  63. package/cjs/plugin/other.js +2 -1
  64. package/cjs/plugin/other.js.map +1 -1
  65. package/cjs/series/bar/bar.js +1 -1
  66. package/cjs/series/bar/bar.js.map +1 -1
  67. package/cjs/series/base/base-series.d.ts +1 -0
  68. package/cjs/series/base/base-series.js +7 -2
  69. package/cjs/series/base/base-series.js.map +1 -1
  70. package/cjs/series/dot/dot.js +6 -2
  71. package/cjs/series/dot/dot.js.map +1 -1
  72. package/cjs/series/util/stack.js +1 -1
  73. package/cjs/series/util/stack.js.map +1 -1
  74. package/cjs/typings/spec/common.js.map +1 -1
  75. package/esm/animation/config.d.ts +1 -0
  76. package/esm/animation/config.js +8 -1
  77. package/esm/animation/config.js.map +1 -1
  78. package/esm/compile/compiler.d.ts +5 -0
  79. package/esm/compile/compiler.js +44 -4
  80. package/esm/compile/compiler.js.map +1 -1
  81. package/esm/compile/interface/compilable-item.d.ts +2 -0
  82. package/esm/compile/interface/compilable-item.js.map +1 -1
  83. package/esm/component/axis/base-axis.d.ts +1 -1
  84. package/esm/component/axis/base-axis.js +1 -1
  85. package/esm/component/axis/base-axis.js.map +1 -1
  86. package/esm/component/axis/cartesian/axis.d.ts +1 -1
  87. package/esm/component/axis/cartesian/axis.js.map +1 -1
  88. package/esm/component/axis/cartesian/band-axis.d.ts +1 -1
  89. package/esm/component/axis/cartesian/band-axis.js.map +1 -1
  90. package/esm/component/axis/interface/common.d.ts +1 -0
  91. package/esm/component/axis/interface/common.js.map +1 -1
  92. package/esm/component/axis/mixin/band-axis-mixin.d.ts +2 -0
  93. package/esm/component/axis/mixin/band-axis-mixin.js +10 -4
  94. package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
  95. package/esm/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
  96. package/esm/component/axis/mixin/linear-axis-mixin.js +15 -1
  97. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  98. package/esm/component/axis/polar/axis.d.ts +1 -1
  99. package/esm/component/axis/polar/axis.js.map +1 -1
  100. package/esm/component/axis/polar/band-axis.d.ts +1 -1
  101. package/esm/component/axis/polar/band-axis.js.map +1 -1
  102. package/esm/component/brush/brush.js +6 -4
  103. package/esm/component/brush/brush.js.map +1 -1
  104. package/esm/component/data-zoom/data-filter-base-component.d.ts +31 -52
  105. package/esm/component/data-zoom/data-filter-base-component.js +155 -232
  106. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  107. package/esm/component/data-zoom/data-filter-event.d.ts +53 -0
  108. package/esm/component/data-zoom/data-filter-event.js +108 -0
  109. package/esm/component/data-zoom/data-filter-event.js.map +1 -0
  110. package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
  111. package/esm/component/data-zoom/data-zoom/data-zoom.js +125 -82
  112. package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  113. package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
  114. package/esm/component/data-zoom/scroll-bar/scroll-bar.js +36 -36
  115. package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
  116. package/esm/component/data-zoom/util.d.ts +14 -0
  117. package/esm/component/data-zoom/util.js +63 -7
  118. package/esm/component/data-zoom/util.js.map +1 -1
  119. package/esm/component/marker/utils.js +1 -1
  120. package/esm/component/marker/utils.js.map +1 -1
  121. package/esm/constant/event.d.ts +1 -0
  122. package/esm/constant/event.js +8 -8
  123. package/esm/constant/event.js.map +1 -1
  124. package/esm/core/index.d.ts +1 -1
  125. package/esm/core/index.js +1 -1
  126. package/esm/core/index.js.map +1 -1
  127. package/esm/mark/base/base-mark.d.ts +2 -1
  128. package/esm/mark/base/base-mark.js +7 -3
  129. package/esm/mark/base/base-mark.js.map +1 -1
  130. package/esm/mark/interface/common.d.ts +1 -0
  131. package/esm/mark/interface/common.js.map +1 -1
  132. package/esm/plugin/other.js +2 -2
  133. package/esm/plugin/other.js.map +1 -1
  134. package/esm/series/bar/bar.js +2 -2
  135. package/esm/series/bar/bar.js.map +1 -1
  136. package/esm/series/base/base-series.d.ts +1 -0
  137. package/esm/series/base/base-series.js +6 -2
  138. package/esm/series/base/base-series.js.map +1 -1
  139. package/esm/series/dot/dot.js +6 -2
  140. package/esm/series/dot/dot.js.map +1 -1
  141. package/esm/series/util/stack.js +2 -2
  142. package/esm/series/util/stack.js.map +1 -1
  143. package/esm/typings/spec/common.js.map +1 -1
  144. package/package.json +8 -8
package/build/index.js CHANGED
@@ -43202,7 +43202,16 @@
43202
43202
  data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
43203
43203
  }
43204
43204
  let labels = this._initText(data);
43205
- labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : !1 !== overlap && (labels = this._overlapping(labels)), 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 => {
43205
+ labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
43206
+ const filteredLabels = [],
43207
+ overlapLabels = labels;
43208
+ if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
43209
+ const getRelatedGraphic = this.getRelatedGraphic.bind(this);
43210
+ labels.forEach(label => {
43211
+ overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
43212
+ });
43213
+ }
43214
+ 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 => {
43206
43215
  this._bindEvent(label), this._setStatesOfText(label);
43207
43216
  }), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), !1 !== this._enableAnimation && this._baseMarks.forEach((mark, index) => {
43208
43217
  mark.initAttributes(markAttributeList[index]);
@@ -45471,15 +45480,18 @@
45471
45480
  pickable: !1
45472
45481
  }, selectedBackgroundChartStyle.area));
45473
45482
  }
45474
- _computeBasePoints() {
45483
+ _computeBasePoints(points) {
45475
45484
  const {
45476
45485
  orient: orient
45477
45486
  } = this.attribute,
45478
- {
45479
- position: position,
45480
- width: width,
45481
- height: height
45482
- } = this._getLayoutAttrFromConfig();
45487
+ key = "bottom" === orient || "top" === orient ? "x" : "y";
45488
+ let lastPointSide = Math.sign(points[points.length - 1][key] - points[0][key]);
45489
+ 0 === lastPointSide && (lastPointSide = 1);
45490
+ const {
45491
+ position: position,
45492
+ width: width,
45493
+ height: height
45494
+ } = this._getLayoutAttrFromConfig();
45483
45495
  let basePointStart, basePointEnd;
45484
45496
  return this._isHorizontal ? (basePointStart = [{
45485
45497
  x: position.x,
@@ -45499,7 +45511,10 @@
45499
45511
  }], basePointEnd = [{
45500
45512
  x: position.x,
45501
45513
  y: position.y
45502
- }]), {
45514
+ }]), Math.sign(basePointEnd[0][key] - basePointStart[0][key]) !== lastPointSide ? {
45515
+ basePointStart: basePointEnd,
45516
+ basePointEnd: basePointStart
45517
+ } : {
45503
45518
  basePointStart: basePointStart,
45504
45519
  basePointEnd: basePointEnd
45505
45520
  };
@@ -45522,7 +45537,7 @@
45522
45537
  const {
45523
45538
  basePointStart: basePointStart,
45524
45539
  basePointEnd: basePointEnd
45525
- } = this._computeBasePoints();
45540
+ } = this._computeBasePoints(previewPoints);
45526
45541
  return basePointStart.concat(previewPoints).concat(basePointEnd);
45527
45542
  }
45528
45543
  _getPreviewAreaPoints() {
@@ -45537,7 +45552,7 @@
45537
45552
  const {
45538
45553
  basePointStart: basePointStart,
45539
45554
  basePointEnd: basePointEnd
45540
- } = this._computeBasePoints();
45555
+ } = this._computeBasePoints(previewPoints);
45541
45556
  return basePointStart.concat(previewPoints).concat(basePointEnd);
45542
45557
  }
45543
45558
  renderText() {
@@ -45950,11 +45965,12 @@
45950
45965
  })));
45951
45966
  }
45952
45967
  setAttributes(params, forceUpdateTag) {
45968
+ var _a, _b;
45953
45969
  const {
45954
45970
  start: start,
45955
45971
  end: end
45956
45972
  } = this.attribute;
45957
- start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
45973
+ 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);
45958
45974
  }
45959
45975
  render() {
45960
45976
  this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"), this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
@@ -53708,6 +53724,7 @@
53708
53724
  ChartEvent["markDeltaYUpdate"] = "markDeltaYUpdate";
53709
53725
  ChartEvent["viewDataLabelUpdate"] = "viewDataLabelUpdate";
53710
53726
  ChartEvent["scaleDomainUpdate"] = "scaleDomainUpdate";
53727
+ ChartEvent["scaleRawDomainUpdate"] = "scaleRawDomainUpdate";
53711
53728
  ChartEvent["scaleUpdate"] = "scaleUpdate";
53712
53729
  ChartEvent["dataZoomChange"] = "dataZoomChange";
53713
53730
  ChartEvent["drill"] = "drill";
@@ -54729,6 +54746,7 @@
54729
54746
  var _a, _b, _c, _d, _e, _f;
54730
54747
  (_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);
54731
54748
  if (this._stage) {
54749
+ this.runStageAnimation();
54732
54750
  this._rootMarks.forEach(g => {
54733
54751
  traverseGroupMark(g, m => {
54734
54752
  if (m.needClear) {
@@ -54771,6 +54789,7 @@
54771
54789
  this.handleLayoutEnd();
54772
54790
  }
54773
54791
  this.findProgressiveMarks();
54792
+ this.updateStateAnimation();
54774
54793
  this._doRender(true);
54775
54794
  this.doPreProgressive();
54776
54795
  log(`--- start of renderMarks(${this._count}) ---`);
@@ -54816,6 +54835,67 @@
54816
54835
  this.renderMarks();
54817
54836
  }
54818
54837
  }
54838
+ setStageAnimationConfig(config) {
54839
+ const animationConfig = {};
54840
+ Object.keys(config).forEach(key => {
54841
+ const value = config[key];
54842
+ if (isArray$1(value)) {
54843
+ animationConfig[key] = value.map(item => {
54844
+ var _a;
54845
+ const options = (_a = item.options) !== null && _a !== void 0 ? _a : {};
54846
+ return Object.assign(Object.assign({}, item), { options: (...args) => {
54847
+ const _options = typeof options === 'function' ? options(...args) : options;
54848
+ return Object.assign({}, _options);
54849
+ } });
54850
+ });
54851
+ }
54852
+ else {
54853
+ animationConfig[key] = Object.assign({}, config[key]);
54854
+ }
54855
+ });
54856
+ this._stateAnimationConfig = animationConfig;
54857
+ }
54858
+ updateStateAnimation() {
54859
+ const allMarks = [];
54860
+ this._rootMarks.forEach(mark => {
54861
+ traverseGroupMark(mark, m => {
54862
+ allMarks.push(m);
54863
+ });
54864
+ });
54865
+ const markAnimationStates = allMarks.map(mark => mark.getAnimationState());
54866
+ const animationState = markAnimationStates.every(state => state === AnimationStateEnum.appear)
54867
+ ? AnimationStateEnum.appear
54868
+ : markAnimationStates.every(state => state === AnimationStateEnum.disappear)
54869
+ ? AnimationStateEnum.disappear
54870
+ : AnimationStateEnum.none;
54871
+ if (!this._stage.context) {
54872
+ this._stage.context = {};
54873
+ }
54874
+ this._stage.context.animationState = animationState;
54875
+ }
54876
+ runStageAnimation() {
54877
+ var _a;
54878
+ const animationState = (_a = this._stage.context) === null || _a === void 0 ? void 0 : _a.animationState;
54879
+ if (!this._stateAnimationConfig || animationState === AnimationStateEnum.none) {
54880
+ return;
54881
+ }
54882
+ const animationConfigs = array(this._stateAnimationConfig[animationState]).filter(config => config.type);
54883
+ if (!animationConfigs.length) {
54884
+ return;
54885
+ }
54886
+ if (animationState === AnimationStateEnum.appear) {
54887
+ this._stage.stopAnimationState(AnimationStateEnum.disappear);
54888
+ }
54889
+ else if (animationState === AnimationStateEnum.disappear) {
54890
+ this._stage.stopAnimationState(AnimationStateEnum.appear);
54891
+ }
54892
+ this._stage.applyAnimationState([animationState], [
54893
+ {
54894
+ name: animationState,
54895
+ animation: animationConfigs
54896
+ }
54897
+ ]);
54898
+ }
54819
54899
  updateViewBox(viewBox, reRender = true) {
54820
54900
  if (!this._stage) {
54821
54901
  return;
@@ -58285,6 +58365,15 @@
58285
58365
  : () => 'key';
58286
58366
  this._dataByGroup = groupData(data, this._groupKeyGetter);
58287
58367
  }
58368
+ getAnimationState() {
58369
+ const graphicsAnimationStates = this._graphics.map(g => g.context.animationState);
58370
+ const animationState = graphicsAnimationStates.every(state => state === AnimationStateEnum.appear)
58371
+ ? AnimationStateEnum.appear
58372
+ : graphicsAnimationStates.every(state => state === AnimationStateEnum.disappear)
58373
+ ? AnimationStateEnum.disappear
58374
+ : graphicsAnimationStates[0];
58375
+ return animationState !== null && animationState !== void 0 ? animationState : AnimationStateEnum.none;
58376
+ }
58288
58377
  createAnimationStateList(type, animationConfig) {
58289
58378
  var _a;
58290
58379
  let config = animationConfig[type];
@@ -58539,14 +58628,14 @@
58539
58628
  _runApplyGraphic(graphics) {
58540
58629
  const hasAnimation = this.hasAnimation();
58541
58630
  graphics.forEach((g, index) => {
58542
- var _a;
58631
+ var _a, _b;
58543
58632
  const finalAttrs = g.context.finalAttrs;
58544
58633
  const hasStateAnimation = this.hasAnimationByState(g.context.animationState);
58545
58634
  if (!g.setAttributes) {
58546
58635
  const mockGraphic = g;
58547
58636
  g = this._createGraphic(finalAttrs);
58548
58637
  if (hasAnimation) {
58549
- g.setFinalAttributes(finalAttrs);
58638
+ (_a = g.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(g, finalAttrs);
58550
58639
  }
58551
58640
  g.context = mockGraphic.context;
58552
58641
  g.context.diffAttrs = finalAttrs;
@@ -58554,7 +58643,7 @@
58554
58643
  if (gIndex >= 0) {
58555
58644
  this._graphics[gIndex] = g;
58556
58645
  }
58557
- if ((_a = this.renderContext) === null || _a === void 0 ? void 0 : _a.progressive) {
58646
+ if ((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) {
58558
58647
  const groupIndex = this._dataByGroup ? this._dataByGroup.keys.indexOf(g.context.groupKey) : 0;
58559
58648
  const group = groupIndex >= 0 ? this._product.getChildAt(groupIndex) : null;
58560
58649
  if (group) {
@@ -59408,10 +59497,20 @@
59408
59497
  const registerPolygonAnimation = () => {
59409
59498
  AnimateExecutor.registerBuiltInAnimate('growPointsOut', GrowPointsOut);
59410
59499
  };
59500
+ const registerStageAnimation = () => {
59501
+ AnimateExecutor.registerBuiltInAnimate('distortion', Distortion);
59502
+ AnimateExecutor.registerBuiltInAnimate('particle', Particle);
59503
+ AnimateExecutor.registerBuiltInAnimate('pixelation', Pixelation);
59504
+ AnimateExecutor.registerBuiltInAnimate('gaussianBlur', GaussianBlur);
59505
+ AnimateExecutor.registerBuiltInAnimate('glitch', Glitch);
59506
+ AnimateExecutor.registerBuiltInAnimate('grayscale', Grayscale);
59507
+ AnimateExecutor.registerBuiltInAnimate('dissolve', Dissolve);
59508
+ };
59411
59509
 
59412
59510
  const registerAnimate = () => {
59413
59511
  registerAnimate$1();
59414
59512
  registerBuiltInAnimation();
59513
+ registerStageAnimation();
59415
59514
  };
59416
59515
  const registerDragPlugin = () => {
59417
59516
  Factory.registerStageEventPlugin('drag', DragNDrop);
@@ -61296,7 +61395,7 @@
61296
61395
  });
61297
61396
  };
61298
61397
 
61299
- const version = "2.0.8";
61398
+ const version = "2.0.9";
61300
61399
 
61301
61400
  const addVChartProperty = (data, op) => {
61302
61401
  const context = op.beforeCall();
@@ -62346,6 +62445,7 @@
62346
62445
  this.initMarkState();
62347
62446
  if (hasAnimation) {
62348
62447
  this.initAnimation();
62448
+ this.initStageAnimation();
62349
62449
  }
62350
62450
  this.afterInitMark();
62351
62451
  this.initEvent();
@@ -62802,6 +62902,13 @@
62802
62902
  }
62803
62903
  initAnimation() {
62804
62904
  }
62905
+ initStageAnimation() {
62906
+ const compiler = this._option.getCompiler();
62907
+ if (!(compiler === null || compiler === void 0 ? void 0 : compiler.setStageAnimationConfig)) {
62908
+ return;
62909
+ }
62910
+ compiler.setStageAnimationConfig(animationConfig({}, userAnimationConfig('stage', this._spec, this._markAttributeContext), null));
62911
+ }
62805
62912
  initMarkState() {
62806
62913
  this.initSeriesStyleState();
62807
62914
  }
@@ -65672,7 +65779,7 @@
65672
65779
  const viewData = s.getViewData();
65673
65780
  if (rawData) {
65674
65781
  field.forEach(f => {
65675
- data.push(s.getRawDataStatisticsByField(f, false));
65782
+ data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
65676
65783
  });
65677
65784
  }
65678
65785
  else if (viewData && viewData.latestData && viewData.latestData.length) {
@@ -66935,8 +67042,12 @@
66935
67042
  class LinearAxisMixin {
66936
67043
  constructor() {
66937
67044
  this._extend = {};
67045
+ this._rawDomain = [];
66938
67046
  this.niceLabelFormatter = null;
66939
67047
  }
67048
+ getRawDomain() {
67049
+ return this._rawDomain;
67050
+ }
66940
67051
  setExtraAttrFromSpec() {
66941
67052
  isValid$1(this._spec.nice) && (this._nice = this._spec.nice);
66942
67053
  isValid$1(this._spec.zero) && (this._zero = this._spec.zero);
@@ -67203,9 +67314,13 @@
67203
67314
  }
67204
67315
  }
67205
67316
  updateScaleDomain() {
67317
+ var _a;
67206
67318
  if (!this.isSeriesDataEnable()) {
67207
67319
  return;
67208
67320
  }
67321
+ if (!((_a = this._rawDomain) === null || _a === void 0 ? void 0 : _a.length) && this._scale) {
67322
+ this._updateRawDomain();
67323
+ }
67209
67324
  const data = this.collectData();
67210
67325
  const domain = this.computeLinearDomain(data);
67211
67326
  this.updateScaleDomainByModel(domain);
@@ -67240,6 +67355,15 @@
67240
67355
  return value;
67241
67356
  };
67242
67357
  }
67358
+ _updateRawDomain() {
67359
+ const data = this.collectData(0, true);
67360
+ const domain = this.computeLinearDomain(data);
67361
+ this._rawDomain = domain;
67362
+ this.event.emit(exports.ChartEvent.scaleRawDomainUpdate, { model: this });
67363
+ }
67364
+ _clearRawDomain() {
67365
+ this._rawDomain = [];
67366
+ }
67243
67367
  }
67244
67368
 
67245
67369
  const axisLinear = {
@@ -67471,6 +67595,7 @@
67471
67595
  class BandAxisMixin {
67472
67596
  constructor() {
67473
67597
  this._rawDomainIndex = [];
67598
+ this._rawDomain = [];
67474
67599
  }
67475
67600
  _initData() {
67476
67601
  var _a;
@@ -67522,6 +67647,9 @@
67522
67647
  tickTransform && (tickTransform.options = this._tickTransformOption());
67523
67648
  }
67524
67649
  }
67650
+ getRawDomain() {
67651
+ return this._rawDomain;
67652
+ }
67525
67653
  dataToPosition(values, cfg = {}) {
67526
67654
  var _a, _b;
67527
67655
  if (values.length === 0 || this._scales.length === 0) {
@@ -67659,6 +67787,7 @@
67659
67787
  }
67660
67788
  _updateRawDomain() {
67661
67789
  this._rawDomainIndex = [];
67790
+ this._rawDomain = [];
67662
67791
  const userDomain = this._spec.domain;
67663
67792
  for (let i = 0; i < this._scales.length; i++) {
67664
67793
  if (userDomain && userDomain.length && i === 0) {
@@ -67668,12 +67797,15 @@
67668
67797
  const data = this.collectData(i, true);
67669
67798
  const domain = this.computeBandDomain(data);
67670
67799
  this._rawDomainIndex[i] = {};
67800
+ this._rawDomain[i] = domain;
67671
67801
  domain.forEach((d, _i) => (this._rawDomainIndex[i][d] = _i));
67672
67802
  }
67673
67803
  }
67804
+ this.event.emit(exports.ChartEvent.scaleRawDomainUpdate, { model: this });
67674
67805
  }
67675
67806
  _clearRawDomain() {
67676
67807
  this._rawDomainIndex = [];
67808
+ this._rawDomain = [];
67677
67809
  }
67678
67810
  }
67679
67811
 
@@ -72011,7 +72143,10 @@
72011
72143
  lastY = y1;
72012
72144
  }
72013
72145
  let height = Math.abs(y1 - y);
72014
- if (height < barMinHeight) {
72146
+ if (height <= 0 && !isValueInScaleDomain(obj[s.getStackValueField()], seriesScale)) {
72147
+ height = 0;
72148
+ }
72149
+ else if (height < barMinHeight) {
72015
72150
  height = barMinHeight;
72016
72151
  }
72017
72152
  let flag = 1;
@@ -72360,7 +72495,10 @@
72360
72495
  const y1 = valueInScaleRange(this[startMethod](datum), seriesScale, useWholeRange);
72361
72496
  const y = valueInScaleRange(this[endMethod](datum), seriesScale, useWholeRange);
72362
72497
  let height = Math.abs(y1 - y);
72363
- if (height < barMinHeight) {
72498
+ if (height <= 0 && !isValueInScaleDomain(datum[this.getStackValueField()], seriesScale)) {
72499
+ height = 0;
72500
+ }
72501
+ else if (height < barMinHeight) {
72364
72502
  height = barMinHeight;
72365
72503
  }
72366
72504
  let flag = 1;
@@ -79378,13 +79516,14 @@
79378
79516
  });
79379
79517
  }
79380
79518
  initMarkStyle() {
79519
+ var _a;
79381
79520
  const clipMark = this._clipMark;
79382
79521
  if (clipMark) {
79383
79522
  this.setMarkStyle(clipMark, {
79384
- x: -this._spec.leftAppendPadding,
79523
+ x: -((_a = this._spec.leftAppendPadding) !== null && _a !== void 0 ? _a : 0),
79385
79524
  y: 0,
79386
79525
  width: 10000,
79387
- height: this._spec.clipHeight
79526
+ height: () => { var _a; return (_a = this._spec.clipHeight) !== null && _a !== void 0 ? _a : this._region.getLayoutRect().height; }
79388
79527
  }, 'normal', exports.AttributeLevel.Series);
79389
79528
  clipMark.setMarkConfig({ interactive: false, clip: true });
79390
79529
  }
@@ -97049,17 +97188,26 @@
97049
97188
  return data.filter(filter);
97050
97189
  };
97051
97190
  const dataFilterComputeDomain = (data, op) => {
97052
- const { stateFields, valueFields, dataCollection, isCategoryState } = op.input;
97191
+ const { stateFields, valueFields, dataCollection, isCategoryState, seriesCollection } = op.input;
97053
97192
  const { stateField, valueField } = op.output;
97054
97193
  const resultObj = {};
97194
+ const resultKeys = [];
97055
97195
  const resultData = [];
97056
97196
  const stateValues = [];
97057
97197
  let hasLockDomain = false;
97198
+ let isAllLinearValue = false;
97058
97199
  dataCollection.forEach((dv, i) => {
97059
97200
  var _a;
97060
97201
  if (isNil$1(stateFields[i])) {
97061
97202
  return;
97062
97203
  }
97204
+ const series = seriesCollection[i];
97205
+ if (series) {
97206
+ const statistics = series.getRawDataStatisticsByField(stateFields[i]);
97207
+ if (isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.max) && isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.min)) {
97208
+ isAllLinearValue = true;
97209
+ }
97210
+ }
97063
97211
  const stateFieldInfo = (_a = dv.getFields()) === null || _a === void 0 ? void 0 : _a[stateFields[i]];
97064
97212
  if (stateFieldInfo && stateFieldInfo.lockStatisticsByDomain) {
97065
97213
  hasLockDomain = true;
@@ -97067,6 +97215,7 @@
97067
97215
  if (isNil$1(resultObj[d])) {
97068
97216
  stateValues.push(d);
97069
97217
  resultObj[d] = 0;
97218
+ resultKeys.push(d);
97070
97219
  }
97071
97220
  });
97072
97221
  }
@@ -97076,6 +97225,7 @@
97076
97225
  if (isNil$1(resultObj[d[state]])) {
97077
97226
  stateValues.push(d[state]);
97078
97227
  resultObj[d[state]] = 0;
97228
+ resultKeys.push(d[state]);
97079
97229
  }
97080
97230
  if (!isNil$1(valueFields[i])) {
97081
97231
  resultObj[d[state]] += isNaN(parseFloat(d[valueFields[i]])) ? 1 : parseFloat(d[valueFields[i]]);
@@ -97086,9 +97236,9 @@
97086
97236
  });
97087
97237
  const sortedStateValues = hasLockDomain
97088
97238
  ? stateValues
97089
- : isCategoryState === false
97239
+ : isCategoryState === false || isAllLinearValue
97090
97240
  ? stateValues.sort((a, b) => a - b)
97091
- : Object.keys(resultObj);
97241
+ : resultKeys;
97092
97242
  sortedStateValues.forEach(state => {
97093
97243
  const res = { [stateField]: state };
97094
97244
  if (valueField) {
@@ -97098,17 +97248,83 @@
97098
97248
  });
97099
97249
  return resultData;
97100
97250
  };
97101
-
97102
- class DataFilterBaseComponent extends BaseComponent {
97103
- get relatedAxisComponent() {
97104
- return this._relatedAxisComponent;
97251
+ const statePointToData = (state, scale, reverse) => {
97252
+ const domain = scale.domain();
97253
+ if (isContinuous(scale.type)) {
97254
+ if (reverse) {
97255
+ return domain[0] + (last(domain) - domain[0]) * (1 - state);
97256
+ }
97257
+ return domain[0] + (last(domain) - domain[0]) * state;
97105
97258
  }
97106
- setStartAndEnd(start, end, rangeMode = ['percent', 'percent']) {
97107
- const [startMode = 'percent', endMode = 'percent'] = rangeMode;
97108
- const startPercent = (startMode === 'percent' ? start : this.dataToStatePoint(start));
97109
- const endPercent = (endMode === 'percent' ? end : this.dataToStatePoint(end));
97110
- this._handleChange(startPercent, endPercent, true);
97259
+ let range = scale.range();
97260
+ if (reverse) {
97261
+ range = range.slice().reverse();
97262
+ }
97263
+ const posInRange = range[0] + (last(range) - range[0]) * state;
97264
+ return scale.invert(posInRange);
97265
+ };
97266
+ const dataToStatePoint = (data, scale, isHorizontal) => {
97267
+ const pos = scale.scale(data);
97268
+ let range = scale.range();
97269
+ if (!isHorizontal && isContinuous(scale.type)) {
97270
+ range = range.slice().reverse();
97271
+ }
97272
+ return Math.max(0, Math.min(1, (pos - range[0]) / (last(range) - range[0])));
97273
+ };
97274
+ const isReverse = (axisComponent, isHorizontal) => {
97275
+ const axis = axisComponent;
97276
+ if (!axis) {
97277
+ return false;
97111
97278
  }
97279
+ const axisScale = axis.getScale();
97280
+ return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || isHorizontal);
97281
+ };
97282
+ const getAxisBandSize = (axisSpec) => {
97283
+ const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
97284
+ const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
97285
+ const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
97286
+ if (bandSize || minBandSize || maxBandSize) {
97287
+ return { bandSize, maxBandSize, minBandSize };
97288
+ }
97289
+ return undefined;
97290
+ };
97291
+ const modeCheck = (statePoint, mode, spec) => {
97292
+ if (statePoint === 'start') {
97293
+ return (mode === 'percent' && isValid$1(spec.start)) || (mode === 'value' && isValid$1(spec.startValue));
97294
+ }
97295
+ return (mode === 'percent' && isValid$1(spec.end)) || (mode === 'value' && isValid$1(spec.endValue));
97296
+ };
97297
+ const parseDomainFromState = (startValue, endValue, scale) => {
97298
+ if (isContinuous(scale.type)) {
97299
+ return [Math.min(endValue, startValue), Math.max(endValue, startValue)];
97300
+ }
97301
+ const allDomain = scale.domain();
97302
+ const startIndex = allDomain.indexOf(startValue);
97303
+ const endIndex = allDomain.indexOf(endValue);
97304
+ return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
97305
+ };
97306
+ const parseDomainFromStateAndValue = (start, startValue, end, endValue, scale) => {
97307
+ if (isContinuous(scale.type)) {
97308
+ const domain = scale.domain();
97309
+ const min = domain[0];
97310
+ const total = last(domain) - min;
97311
+ const resultStart = isValid$1(start) ? min + total * start : +startValue;
97312
+ const resultEnd = isValid$1(end) ? min + total * end : +endValue;
97313
+ return [Math.min(resultEnd, resultStart), Math.max(resultEnd, resultStart)];
97314
+ }
97315
+ const allDomain = scale.domain();
97316
+ const range = scale.range();
97317
+ const rangeSize = range[range.length - 1] - range[0];
97318
+ const startIndex = isValid$1(start)
97319
+ ? allDomain.indexOf(scale.invert(rangeSize * start + range[0]))
97320
+ : allDomain.indexOf(startValue);
97321
+ const endIndex = isValid$1(end)
97322
+ ? allDomain.indexOf(scale.invert(rangeSize * end + range[0]))
97323
+ : allDomain.indexOf(endValue);
97324
+ return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
97325
+ };
97326
+
97327
+ class DataFilterEvent {
97112
97328
  enableInteraction() {
97113
97329
  this._activeRoam = true;
97114
97330
  }
@@ -97116,19 +97332,203 @@
97116
97332
  this._activeRoam = false;
97117
97333
  }
97118
97334
  zoomIn(location) {
97119
- this._handleChartZoom({
97335
+ this.handleChartZoom({
97120
97336
  zoomDelta: 1.2,
97121
97337
  zoomX: location === null || location === void 0 ? void 0 : location.x,
97122
97338
  zoomY: location === null || location === void 0 ? void 0 : location.y
97123
97339
  });
97124
97340
  }
97125
97341
  zoomOut(location) {
97126
- this._handleChartZoom({
97342
+ this.handleChartZoom({
97127
97343
  zoomDelta: 0.8,
97128
97344
  zoomX: location === null || location === void 0 ? void 0 : location.x,
97129
97345
  zoomY: location === null || location === void 0 ? void 0 : location.y
97130
97346
  });
97131
97347
  }
97348
+ constructor(type, spec, handleChange, getLayoutRect, getState, getRegions, getOption, getEvent) {
97349
+ this._activeRoam = true;
97350
+ this._zoomAttr = {
97351
+ enable: true,
97352
+ rate: 1,
97353
+ focus: true
97354
+ };
97355
+ this._dragAttr = {
97356
+ enable: true,
97357
+ rate: 1,
97358
+ reverse: true
97359
+ };
97360
+ this._scrollAttr = {
97361
+ enable: true,
97362
+ rate: 1,
97363
+ reverse: true
97364
+ };
97365
+ this.initZoomEvent = () => {
97366
+ var _a, _b, _c, _d, _e, _f, _g;
97367
+ const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
97368
+ 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;
97369
+ const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
97370
+ const option = { delayType, delayTime, realTime, allowComponentZoom: true };
97371
+ if (this._zoomAttr.enable) {
97372
+ this.initZoomEventOfRegions(this.getRegions(), null, this.handleChartZoom, option);
97373
+ }
97374
+ if (this._scrollAttr.enable) {
97375
+ this.initScrollEventOfRegions(this.getRegions(), null, this.handleChartScroll, option);
97376
+ }
97377
+ if (this._dragAttr.enable) {
97378
+ this.initDragEventOfRegions(this.getRegions(), null, this.handleChartDrag, option);
97379
+ }
97380
+ };
97381
+ this.handleChartZoom = (params, e) => {
97382
+ var _a, _b;
97383
+ if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
97384
+ return;
97385
+ }
97386
+ const { zoomDelta, zoomX, zoomY } = params;
97387
+ const { x, y } = this.getRegions()[0].getLayoutStartPoint();
97388
+ const { width, height } = this.getRegions()[0].getLayoutRect();
97389
+ const delta = Math.abs(this.getState().start - this.getState().end);
97390
+ const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
97391
+ if (delta >= 1 && zoomDelta < 1) {
97392
+ return;
97393
+ }
97394
+ if (delta <= 0.01 && zoomDelta > 1) {
97395
+ return;
97396
+ }
97397
+ const focusLoc = this._isHorizontal ? zoomX : zoomY;
97398
+ const totalValue = delta * (zoomDelta - 1) * zoomRate;
97399
+ let startValue = totalValue / 2;
97400
+ let endValue = totalValue / 2;
97401
+ if (focusLoc) {
97402
+ const startLoc = this._isHorizontal ? x : y;
97403
+ const endLoc = this._isHorizontal ? width : height;
97404
+ startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
97405
+ endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
97406
+ }
97407
+ const start = clamp$1(this.getState().start + startValue, 0, 1);
97408
+ const end = clamp$1(this.getState().end - endValue, 0, 1);
97409
+ this._handleChange(Math.min(start, end), Math.max(start, end), true);
97410
+ };
97411
+ this.handleChartScroll = (params, e) => {
97412
+ var _a;
97413
+ if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
97414
+ return false;
97415
+ }
97416
+ const { scrollX, scrollY } = params;
97417
+ let value = this._isHorizontal ? scrollX : scrollY;
97418
+ const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
97419
+ if (!this._scrollAttr.reverse) {
97420
+ value = -value;
97421
+ }
97422
+ if (active) {
97423
+ this.handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
97424
+ }
97425
+ const hasChange = this.getState().start !== 0 && this.getState().end !== 1;
97426
+ return active && hasChange;
97427
+ };
97428
+ this.handleChartDrag = (delta, e) => {
97429
+ var _a;
97430
+ if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
97431
+ return;
97432
+ }
97433
+ const [dx, dy] = delta;
97434
+ let value = this._isHorizontal ? dx : dy;
97435
+ if (this._dragAttr.reverse) {
97436
+ value = -value;
97437
+ }
97438
+ this.handleChartMove(value, (_a = this._dragAttr.rate) !== null && _a !== void 0 ? _a : 1);
97439
+ };
97440
+ this.handleChartMove = (value, rate) => {
97441
+ const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
97442
+ if (Math.abs(value) >= 1e-6) {
97443
+ if (value > 0 && this.getState().end < 1) {
97444
+ const moveDelta = Math.min(1 - this.getState().end, value / totalValue) * rate;
97445
+ this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
97446
+ }
97447
+ else if (value < 0 && this.getState().start > 0) {
97448
+ const moveDelta = Math.max(-this.getState().start, value / totalValue) * rate;
97449
+ this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
97450
+ }
97451
+ }
97452
+ return false;
97453
+ };
97454
+ this._type = type;
97455
+ this._spec = spec;
97456
+ this._handleChange = handleChange;
97457
+ this.getLayoutRect = getLayoutRect;
97458
+ this.getState = getState;
97459
+ this.getRegions = getRegions;
97460
+ this._regions = getRegions();
97461
+ this.getOption = getOption;
97462
+ this._option = getOption();
97463
+ this.getEvent = getEvent;
97464
+ this._isHorizontal = getDirectionByOrient(getOrient(spec)) === "horizontal";
97465
+ }
97466
+ setEventAttrFromSpec() {
97467
+ if (this._spec.roamZoom === true || this._spec.roamZoom) {
97468
+ this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
97469
+ }
97470
+ else {
97471
+ this._zoomAttr.enable = false;
97472
+ }
97473
+ if (this._spec.roamDrag === true || this._spec.roamDrag) {
97474
+ this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
97475
+ }
97476
+ else {
97477
+ this._dragAttr.enable = false;
97478
+ }
97479
+ if (this._spec.roamScroll === true || this._spec.roamScroll) {
97480
+ this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
97481
+ }
97482
+ else {
97483
+ this._scrollAttr.enable = false;
97484
+ }
97485
+ if (isBoolean$1(this._spec.roam)) {
97486
+ this._zoomAttr.enable = this._type === 'scrollBar' ? false : this._spec.roam;
97487
+ this._dragAttr.enable = this._spec.roam;
97488
+ this._scrollAttr.enable = this._spec.roam;
97489
+ }
97490
+ if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
97491
+ this.initZoomable(this.getEvent(), this._option.mode);
97492
+ }
97493
+ }
97494
+ }
97495
+ mixin(DataFilterEvent, Zoomable);
97496
+
97497
+ class DataFilterBaseComponent extends BaseComponent {
97498
+ get isHorizontal() {
97499
+ return this._isHorizontal;
97500
+ }
97501
+ get stateScale() {
97502
+ return this._stateScale;
97503
+ }
97504
+ get relatedAxisComponent() {
97505
+ return this._relatedAxisComponent;
97506
+ }
97507
+ setStartAndEnd(start, end, rangeMode = ['percent', 'percent']) {
97508
+ const [startMode = 'percent', endMode = 'percent'] = rangeMode;
97509
+ const startPercent = (startMode === 'percent' ? start : dataToStatePoint(start, this._stateScale, this._isHorizontal));
97510
+ const endPercent = (endMode === 'percent' ? end : dataToStatePoint(end, this._stateScale, this._isHorizontal));
97511
+ this._handleChange(startPercent, endPercent, true);
97512
+ }
97513
+ enableInteraction() {
97514
+ this._dataFilterEvent.enableInteraction();
97515
+ }
97516
+ disableInteraction() {
97517
+ this._dataFilterEvent.disableInteraction();
97518
+ }
97519
+ zoomIn(location) {
97520
+ this._dataFilterEvent.zoomIn(location);
97521
+ }
97522
+ zoomOut(location) {
97523
+ this._dataFilterEvent.zoomOut(location);
97524
+ }
97525
+ _initEvent() {
97526
+ var _a;
97527
+ this._dataFilterEvent.initZoomEvent();
97528
+ (_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.event.on(exports.ChartEvent.scaleRawDomainUpdate, ({ model }) => {
97529
+ console.log('scaleRawDomainUpdate', model.getRawDomain());
97530
+ });
97531
+ }
97132
97532
  _handleChange(start, end, updateComponent) {
97133
97533
  var _a, _b;
97134
97534
  const zoomLock = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.zoomLock) !== null && _b !== void 0 ? _b : false;
@@ -97142,18 +97542,10 @@
97142
97542
  this._spanCache = end - start;
97143
97543
  }
97144
97544
  }
97145
- _isReverse() {
97146
- const axis = this._relatedAxisComponent;
97147
- if (!axis) {
97148
- return false;
97149
- }
97150
- const axisScale = axis.getScale();
97151
- return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || this._isHorizontal);
97152
- }
97153
97545
  _updateRangeFactor(tag) {
97154
97546
  const axis = this._relatedAxisComponent;
97155
97547
  const axisScale = axis.getScale();
97156
- const reverse = this._isReverse();
97548
+ const reverse = isReverse(axis, this._isHorizontal);
97157
97549
  const newRangeFactor = reverse ? [1 - this._end, 1 - this._start] : [this._start, this._end];
97158
97550
  if (reverse) {
97159
97551
  switch (tag) {
@@ -97200,23 +97592,16 @@
97200
97592
  this._orient = 'left';
97201
97593
  this._cacheVisibility = undefined;
97202
97594
  this._dataUpdating = false;
97595
+ this._hasInitStateScale = false;
97203
97596
  this._shouldChange = true;
97204
97597
  this._stateField = 'x';
97205
- this._activeRoam = true;
97206
- this._zoomAttr = {
97207
- enable: true,
97208
- rate: 1,
97209
- focus: true
97210
- };
97211
- this._dragAttr = {
97212
- enable: true,
97213
- rate: 1,
97214
- reverse: true
97215
- };
97216
- this._scrollAttr = {
97217
- enable: true,
97218
- rate: 1,
97219
- reverse: true
97598
+ this._handleStateChange = (startValue, endValue, tag) => {
97599
+ var _a, _b;
97600
+ this._startValue = startValue;
97601
+ this._endValue = endValue;
97602
+ this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
97603
+ (_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
97604
+ return true;
97220
97605
  };
97221
97606
  this.effect = {
97222
97607
  onZoomChange: (tag) => {
@@ -97225,7 +97610,7 @@
97225
97610
  if (axis && this._filterMode === 'axis') {
97226
97611
  const axisScale = axis.getScale();
97227
97612
  const axisSpec = axis.getSpec();
97228
- if (this._auto && this._getAxisBandSize(axisSpec) && this._spec.ignoreBandSize) {
97613
+ if (this._auto && getAxisBandSize(axisSpec) && this._spec.ignoreBandSize) {
97229
97614
  axisScale.bandwidth('auto');
97230
97615
  axisScale.maxBandwidth('auto');
97231
97616
  axisScale.minBandwidth('auto');
@@ -97256,92 +97641,14 @@
97256
97641
  }
97257
97642
  };
97258
97643
  this._visible = true;
97259
- this._handleStateChange = (startValue, endValue, tag) => {
97260
- var _a, _b;
97261
- this._startValue = startValue;
97262
- this._endValue = endValue;
97263
- this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
97264
- (_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
97265
- return true;
97266
- };
97267
- this._handleChartZoom = (params, e) => {
97268
- var _a, _b;
97269
- if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
97270
- return;
97271
- }
97272
- const { zoomDelta, zoomX, zoomY } = params;
97273
- const { x, y } = this._regions[0].getLayoutStartPoint();
97274
- const { width, height } = this._regions[0].getLayoutRect();
97275
- const delta = Math.abs(this._start - this._end);
97276
- const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
97277
- if (delta >= 1 && zoomDelta < 1) {
97278
- return;
97279
- }
97280
- if (delta <= 0.01 && zoomDelta > 1) {
97281
- return;
97282
- }
97283
- const focusLoc = this._isHorizontal ? zoomX : zoomY;
97284
- const totalValue = delta * (zoomDelta - 1) * zoomRate;
97285
- let startValue = totalValue / 2;
97286
- let endValue = totalValue / 2;
97287
- if (focusLoc) {
97288
- const startLoc = this._isHorizontal ? x : y;
97289
- const endLoc = this._isHorizontal ? width : height;
97290
- startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
97291
- endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
97292
- }
97293
- const start = clamp$1(this._start + startValue, 0, 1);
97294
- const end = clamp$1(this._end - endValue, 0, 1);
97295
- this._handleChange(Math.min(start, end), Math.max(start, end), true);
97296
- };
97297
- this._handleChartScroll = (params, e) => {
97298
- var _a;
97299
- if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
97300
- return false;
97301
- }
97302
- const { scrollX, scrollY } = params;
97303
- let value = this._isHorizontal ? scrollX : scrollY;
97304
- const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
97305
- if (!this._scrollAttr.reverse) {
97306
- value = -value;
97307
- }
97308
- if (active) {
97309
- this._handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
97310
- }
97311
- const hasChange = this._start !== 0 && this._end !== 1;
97312
- return active && hasChange;
97313
- };
97314
- this._handleChartDrag = (delta, e) => {
97315
- var _a, _b;
97316
- if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
97317
- return;
97318
- }
97319
- if ((_a = this._spec.roamDrag) === null || _a === void 0 ? void 0 : _a.autoVisible) {
97320
- this.show();
97321
- }
97322
- const [dx, dy] = delta;
97323
- let value = this._isHorizontal ? dx : dy;
97324
- if (this._dragAttr.reverse) {
97325
- value = -value;
97326
- }
97327
- this._handleChartMove(value, (_b = this._dragAttr.rate) !== null && _b !== void 0 ? _b : 1);
97328
- };
97329
- this._handleChartMove = (value, rate) => {
97330
- const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
97331
- if (Math.abs(value) >= 1e-6) {
97332
- if (value > 0 && this._end < 1) {
97333
- const moveDelta = Math.min(1 - this._end, value / totalValue) * rate;
97334
- this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
97335
- }
97336
- else if (value < 0 && this._start > 0) {
97337
- const moveDelta = Math.max(-this._start, value / totalValue) * rate;
97338
- this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
97339
- }
97340
- }
97341
- return false;
97342
- };
97343
97644
  this._orient = getOrient(spec);
97344
97645
  this._isHorizontal = getDirectionByOrient(this._orient) === "horizontal";
97646
+ this._dataFilterEvent = new DataFilterEvent(this.type, this._spec, this._handleChange.bind(this), this.getLayoutRect.bind(this), () => {
97647
+ return {
97648
+ start: this._start,
97649
+ end: this._end
97650
+ };
97651
+ }, () => this._regions, (() => this._option).bind(this), () => this.event);
97345
97652
  }
97346
97653
  created() {
97347
97654
  super.created();
@@ -97356,6 +97663,88 @@
97356
97663
  super.initLayout();
97357
97664
  this._layout && (this._layout.layoutOrient = this._orient);
97358
97665
  }
97666
+ init(option) {
97667
+ super.init(option);
97668
+ this._addTransformToSeries();
97669
+ if (this._start !== 0 || this._end !== 1) {
97670
+ this.effect.onZoomChange();
97671
+ }
97672
+ }
97673
+ _compareSpec(spec, prevSpec) {
97674
+ const result = super._compareSpec(spec, prevSpec);
97675
+ if (!result.reMake && !isEqual(prevSpec, spec)) {
97676
+ result.reRender = true;
97677
+ result.reMake = true;
97678
+ }
97679
+ return result;
97680
+ }
97681
+ reInit(spec) {
97682
+ super.reInit(spec);
97683
+ this._marks.forEach(g => {
97684
+ g.getMarks().forEach(m => {
97685
+ this.initMarkStyleWithSpec(m, this._spec[m.name]);
97686
+ });
97687
+ });
97688
+ }
97689
+ onLayoutStart(layoutRect, viewRect) {
97690
+ super.onLayoutStart(layoutRect, viewRect);
97691
+ const isShown = this._autoUpdate(layoutRect);
97692
+ this._autoVisible(isShown);
97693
+ this._dataUpdating = false;
97694
+ }
97695
+ updateLayoutAttribute() {
97696
+ this._visible && this._createOrUpdateComponent();
97697
+ if (!this._hasInitStateScale) {
97698
+ if (this._start !== 0 || this._end !== 1) {
97699
+ this._newDomain = parseDomainFromStateAndValue(this._spec.start, this._startValue, this._spec.end, this._endValue, this._stateScale);
97700
+ this.effect.onZoomChange();
97701
+ }
97702
+ this._hasInitStateScale = true;
97703
+ }
97704
+ }
97705
+ _initAfterLayout() {
97706
+ this._stateScale = null;
97707
+ this._initStateScale();
97708
+ this._updateScaleRange();
97709
+ this._setStateFromAxis();
97710
+ }
97711
+ _beforeLayoutEnd() {
97712
+ if (!this._hasInitStateScale) {
97713
+ this._initAfterLayout();
97714
+ }
97715
+ else {
97716
+ this._updateScaleRange();
97717
+ }
97718
+ }
97719
+ onLayoutEnd() {
97720
+ var _a;
97721
+ this._beforeLayoutEnd();
97722
+ const isShown = !(this._start === 0 && this._end === 1);
97723
+ this._autoVisible(isShown);
97724
+ super.onLayoutEnd();
97725
+ (_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.updateScaleRange();
97726
+ }
97727
+ getBoundsInRect(rect) {
97728
+ const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
97729
+ if (this._isHorizontal) {
97730
+ result.y2 = result.y1 + this._height;
97731
+ result.x2 = result.x1 + rect.width;
97732
+ }
97733
+ else {
97734
+ result.x2 = result.x1 + this._width;
97735
+ result.y2 = result.y1 + rect.height;
97736
+ }
97737
+ return result;
97738
+ }
97739
+ setAttrFromSpec() {
97740
+ var _a;
97741
+ super.setAttrFromSpec();
97742
+ this._dataFilterEvent.setEventAttrFromSpec();
97743
+ this._field = this._spec.field;
97744
+ this._width = this._computeWidth();
97745
+ this._height = this._computeHeight();
97746
+ this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
97747
+ }
97359
97748
  _setAxisFromSpec() {
97360
97749
  if (isValid$1(this._spec.axisId)) {
97361
97750
  this._relatedAxisComponent = this._option.getComponentByUserId(this._spec.axisId);
@@ -97365,7 +97754,7 @@
97365
97754
  }
97366
97755
  if (isNil$1(this._spec.field) && !this._relatedAxisComponent) {
97367
97756
  const axes = this._option.getComponentsByKey('axes');
97368
- const sameOrientAxis = axes.find((cm) => cm._orient === this._orient);
97757
+ const sameOrientAxis = axes.find((cm) => getDirectionByOrient(cm._orient) === getDirectionByOrient(this._orient));
97369
97758
  if (sameOrientAxis) {
97370
97759
  this._relatedAxisComponent = sameOrientAxis;
97371
97760
  }
@@ -97416,33 +97805,9 @@
97416
97805
  }
97417
97806
  return;
97418
97807
  }
97419
- onDataUpdate() {
97420
- var _a;
97421
- const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
97422
- this._stateScale.domain(domain, false);
97423
- this._handleChange(this._start, this._end, true);
97424
- if (this._spec.auto && !isEqual(this._domainCache, domain)) {
97425
- this._domainCache = domain;
97426
- this._dataUpdating = true;
97427
- (_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
97428
- }
97429
- }
97430
- _computeDomainOfStateScale(isContinuous) {
97431
- if (this._spec.customDomain) {
97432
- return this._spec.customDomain;
97433
- }
97434
- const domain = this._data.getLatestData().map((d) => d[this._stateField]);
97435
- if (isContinuous) {
97436
- const domainNum = domain.map((n) => n * 1);
97437
- return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
97438
- }
97439
- return domain;
97440
- }
97441
- _initEvent() {
97442
- this._initCommonEvent();
97443
- }
97444
97808
  _initData() {
97445
97809
  const dataCollection = [];
97810
+ const seriesCollection = [];
97446
97811
  const stateFields = [];
97447
97812
  const valueFields = [];
97448
97813
  let isCategoryState;
@@ -97471,6 +97836,8 @@
97471
97836
  ? xAxisHelper
97472
97837
  : yAxisHelper;
97473
97838
  const valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
97839
+ const isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type);
97840
+ const isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
97474
97841
  dataCollection.push(s.getRawData());
97475
97842
  const seriesSpec = s.getSpec();
97476
97843
  const xField = s.coordinate === 'cartesian'
@@ -97481,16 +97848,17 @@
97481
97848
  : array((_b = seriesSpec.radiusField) !== null && _b !== void 0 ? _b : seriesSpec.valueField);
97482
97849
  originalStateFields[s.id] =
97483
97850
  s.type === 'link' ? ['from_xField'] : stateAxisHelper === xAxisHelper ? xField : yField;
97484
- if (isContinuous(stateAxisHelper.getScale(0).type)) {
97851
+ if (isValidateStateAxis) {
97485
97852
  isCategoryState = false;
97486
97853
  stateFields.push(originalStateFields[s.id]);
97487
97854
  }
97488
97855
  else {
97856
+ isCategoryState = true;
97489
97857
  stateFields.push(originalStateFields[s.id][0]);
97490
97858
  }
97491
97859
  if (this._valueField) {
97492
97860
  const valueField = s.type === 'link' ? ['from_yField'] : valueAxisHelper === xAxisHelper ? xField : yField;
97493
- if (isContinuous(valueAxisHelper.getScale(0).type)) {
97861
+ if (isValidateValueAxis) {
97494
97862
  valueFields.push(...valueField);
97495
97863
  }
97496
97864
  }
@@ -97503,6 +97871,7 @@
97503
97871
  else {
97504
97872
  eachSeries(this._regions, s => {
97505
97873
  dataCollection.push(s.getRawData());
97874
+ seriesCollection.push(s);
97506
97875
  stateFields.push(this._field);
97507
97876
  if (this._valueField) {
97508
97877
  valueFields.push(this._spec.valueField);
@@ -97521,6 +97890,7 @@
97521
97890
  options: {
97522
97891
  input: {
97523
97892
  dataCollection: dataCollection,
97893
+ seriesCollection,
97524
97894
  stateFields,
97525
97895
  valueFields,
97526
97896
  isCategoryState
@@ -97535,136 +97905,6 @@
97535
97905
  data.reRunAllTransform();
97536
97906
  dataSet.multipleDataViewAddListener(dataCollection, 'change', this._handleDataCollectionChange.bind(this));
97537
97907
  }
97538
- setAttrFromSpec() {
97539
- var _a;
97540
- super.setAttrFromSpec();
97541
- if (this._spec.roamZoom === true || this._spec.roamZoom) {
97542
- this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
97543
- }
97544
- else {
97545
- this._zoomAttr.enable = false;
97546
- }
97547
- if (this._spec.roamDrag === true || this._spec.roamDrag) {
97548
- this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
97549
- }
97550
- else {
97551
- this._dragAttr.enable = false;
97552
- }
97553
- if (this._spec.roamScroll === true || this._spec.roamScroll) {
97554
- this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
97555
- }
97556
- else {
97557
- this._scrollAttr.enable = false;
97558
- }
97559
- this._field = this._spec.field;
97560
- this._width = this._computeWidth();
97561
- this._height = this._computeHeight();
97562
- this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
97563
- }
97564
- statePointToData(state) {
97565
- const scale = this._stateScale;
97566
- const domain = scale.domain();
97567
- if (isContinuous(scale.type)) {
97568
- if (this._isReverse()) {
97569
- return domain[0] + (last(domain) - domain[0]) * (1 - state);
97570
- }
97571
- return domain[0] + (last(domain) - domain[0]) * state;
97572
- }
97573
- let range = scale.range();
97574
- if (this._isReverse()) {
97575
- range = range.slice().reverse();
97576
- }
97577
- const posInRange = range[0] + (last(range) - range[0]) * state;
97578
- return scale.invert(posInRange);
97579
- }
97580
- dataToStatePoint(data) {
97581
- const scale = this._stateScale;
97582
- const pos = scale.scale(data);
97583
- let range = scale.range();
97584
- if (!this._isHorizontal && isContinuous(scale.type)) {
97585
- range = range.slice().reverse();
97586
- }
97587
- return (pos - range[0]) / (last(range) - range[0]);
97588
- }
97589
- _modeCheck(statePoint, mode) {
97590
- if (statePoint === 'start') {
97591
- return (mode === 'percent' && isValid$1(this._spec.start)) || (mode === 'value' && isValid$1(this._spec.startValue));
97592
- }
97593
- return (mode === 'percent' && isValid$1(this._spec.end)) || (mode === 'value' && isValid$1(this._spec.endValue));
97594
- }
97595
- _setStateFromSpec() {
97596
- var _a, _b;
97597
- this._auto = !!this._spec.auto;
97598
- let start;
97599
- let end;
97600
- if (this._spec.rangeMode) {
97601
- const [startMode, endMode] = this._spec.rangeMode;
97602
- if (this._modeCheck('start', startMode) && this._modeCheck('end', endMode)) {
97603
- start = startMode === 'percent' ? this._spec.start : this.dataToStatePoint(this._spec.startValue);
97604
- end = endMode === 'percent' ? this._spec.end : this.dataToStatePoint(this._spec.endValue);
97605
- }
97606
- }
97607
- else {
97608
- start = this._spec.start
97609
- ? this._spec.start
97610
- : this._spec.startValue
97611
- ? this.dataToStatePoint(this._spec.startValue)
97612
- : 0;
97613
- end = this._spec.end ? this._spec.end : this._spec.endValue ? this.dataToStatePoint(this._spec.endValue) : 1;
97614
- }
97615
- this._startValue = this.statePointToData(start);
97616
- this._endValue = this.statePointToData(end);
97617
- this._start = start;
97618
- this._end = end;
97619
- this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
97620
- this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
97621
- if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
97622
- if (this._spec.minValueSpan) {
97623
- this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
97624
- }
97625
- if (this._spec.maxValueSpan) {
97626
- this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
97627
- }
97628
- }
97629
- this._minSpan = Math.max(0, this._minSpan);
97630
- this._maxSpan = Math.min(this._maxSpan, 1);
97631
- if ((!this._relatedAxisComponent || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
97632
- this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
97633
- }
97634
- }
97635
- _parseFieldOfSeries(s) {
97636
- var _a;
97637
- return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
97638
- }
97639
- _initStateScale() {
97640
- const defaultRange = [0, 1];
97641
- if (this._relatedAxisComponent) {
97642
- const scale = this._relatedAxisComponent.getScale();
97643
- const isContinuousScale = isContinuous(scale.type);
97644
- const domain = this._computeDomainOfStateScale(isContinuousScale);
97645
- this._stateScale = scale.clone();
97646
- if (isContinuousScale) {
97647
- const domainNum = domain.map((n) => n * 1);
97648
- this._stateScale
97649
- .domain(domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [0, 1], true)
97650
- .range(defaultRange);
97651
- }
97652
- else {
97653
- this._stateScale.domain(domain, true).range(defaultRange);
97654
- }
97655
- }
97656
- else {
97657
- this._stateScale = new BandScale();
97658
- this._stateScale.domain(this._computeDomainOfStateScale(), true).range(defaultRange);
97659
- }
97660
- }
97661
- init(option) {
97662
- super.init(option);
97663
- this._addTransformToSeries();
97664
- if (this._start !== 0 || this._end !== 1) {
97665
- this.effect.onZoomChange();
97666
- }
97667
- }
97668
97908
  _addTransformToSeries() {
97669
97909
  if (!this._relatedAxisComponent || this._filterMode !== 'axis') {
97670
97910
  registerDataSetInstanceTransform(this._option.dataSet, 'dataFilterWithNewDomain', dataFilterWithNewDomain);
@@ -97703,59 +97943,116 @@
97703
97943
  });
97704
97944
  }
97705
97945
  }
97706
- _compareSpec(spec, prevSpec) {
97707
- const result = super._compareSpec(spec, prevSpec);
97708
- if (!result.reMake && !isEqual(prevSpec, spec)) {
97709
- result.reRender = true;
97710
- result.reMake = true;
97946
+ onDataUpdate() {
97947
+ var _a;
97948
+ const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
97949
+ this._stateScale.domain(domain, false);
97950
+ this._handleChange(this._start, this._end, true);
97951
+ if (this._spec.auto && !isEqual(this._domainCache, domain)) {
97952
+ this._domainCache = domain;
97953
+ this._dataUpdating = true;
97954
+ (_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
97711
97955
  }
97712
- return result;
97713
97956
  }
97714
- reInit(spec) {
97715
- super.reInit(spec);
97716
- this._marks.forEach(g => {
97717
- g.getMarks().forEach(m => {
97718
- this.initMarkStyleWithSpec(m, this._spec[m.name]);
97719
- });
97720
- });
97957
+ _parseFieldOfSeries(s) {
97958
+ var _a;
97959
+ return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
97721
97960
  }
97722
- _parseDomainFromState(startValue, endValue) {
97723
- if (isContinuous(this._stateScale.type)) {
97724
- return [Math.min(endValue, startValue), Math.max(endValue, startValue)];
97961
+ _setStateFromSpec() {
97962
+ this._auto = !!this._spec.auto;
97963
+ let start;
97964
+ let end;
97965
+ if (this._spec.rangeMode) {
97966
+ const [startMode, endMode] = this._spec.rangeMode;
97967
+ if (modeCheck('start', startMode, this._spec) && modeCheck('end', endMode, this._spec)) {
97968
+ start =
97969
+ startMode === 'percent'
97970
+ ? this._spec.start
97971
+ : dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal);
97972
+ end =
97973
+ endMode === 'percent'
97974
+ ? this._spec.end
97975
+ : dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal);
97976
+ }
97977
+ }
97978
+ else {
97979
+ start = this._spec.start
97980
+ ? this._spec.start
97981
+ : this._spec.startValue
97982
+ ? dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal)
97983
+ : 0;
97984
+ end = this._spec.end
97985
+ ? this._spec.end
97986
+ : this._spec.endValue
97987
+ ? dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal)
97988
+ : 1;
97725
97989
  }
97726
- const allDomain = this._stateScale.domain();
97727
- const startIndex = allDomain.indexOf(startValue);
97728
- const endIndex = allDomain.indexOf(endValue);
97729
- return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
97990
+ this._start = Math.max(0, Math.min(1, start));
97991
+ this._end = Math.max(0, Math.min(1, end));
97730
97992
  }
97731
- _initCommonEvent() {
97732
- var _a, _b, _c, _d, _e, _f, _g, _h;
97733
- const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
97734
- 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;
97735
- const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
97736
- const option = { delayType, delayTime, realTime, allowComponentZoom: true };
97737
- if (this._zoomAttr.enable) {
97738
- this.initZoomEventOfRegions(this._regions, null, this._handleChartZoom, option);
97739
- }
97740
- if (this._scrollAttr.enable) {
97741
- this.initScrollEventOfRegions(this._regions, null, this._handleChartScroll, option);
97742
- }
97743
- if (this._dragAttr.enable) {
97744
- this.initDragEventOfRegions(this._regions, null, this._handleChartDrag, option);
97745
- }
97746
- if ((_h = this._spec.roamDrag) === null || _h === void 0 ? void 0 : _h.autoVisible) {
97747
- const dragEnd = 'panend';
97748
- this._throttledHide = throttle(() => this.hide(), 300);
97749
- this.event.on(dragEnd, () => {
97750
- this._throttledHide();
97751
- });
97993
+ _setStateFromAxis() {
97994
+ var _a, _b;
97995
+ this._setStateFromSpec();
97996
+ const axis = this._relatedAxisComponent;
97997
+ this._startValue = statePointToData(this._start, this._stateScale, isReverse(axis, this._isHorizontal));
97998
+ this._endValue = statePointToData(this._end, this._stateScale, isReverse(axis, this._isHorizontal));
97999
+ this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
98000
+ this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
98001
+ if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
98002
+ if (this._spec.minValueSpan) {
98003
+ this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
98004
+ }
98005
+ if (this._spec.maxValueSpan) {
98006
+ this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
98007
+ }
98008
+ }
98009
+ this._minSpan = Math.max(0, this._minSpan);
98010
+ this._maxSpan = Math.min(this._maxSpan, 1);
98011
+ if (!axis) {
98012
+ return;
98013
+ }
98014
+ if ((!axis || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
98015
+ this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
97752
98016
  }
97753
98017
  }
97754
- updateLayoutAttribute() {
97755
- if (this._visible) {
97756
- this._createOrUpdateComponent();
98018
+ _initStateScale() {
98019
+ var _a, _b, _c, _d, _e, _f;
98020
+ const defaultRange = [0, 1];
98021
+ if (this._relatedAxisComponent) {
98022
+ const scale = this._relatedAxisComponent.getScale().clone();
98023
+ this._stateScale = scale;
98024
+ (_b = (_a = scale).maxBandwidth) === null || _b === void 0 ? void 0 : _b.call(_a, 'auto', true);
98025
+ (_d = (_c = scale).minBandwidth) === null || _d === void 0 ? void 0 : _d.call(_c, 'auto', true);
98026
+ (_f = (_e = scale).bandwidth) === null || _f === void 0 ? void 0 : _f.call(_e, 'auto', true);
98027
+ scale.rangeFactor(defaultRange, true).range(defaultRange);
98028
+ }
98029
+ else {
98030
+ let fieldLinear = true;
98031
+ if (this._field) {
98032
+ eachSeries(this._regions, s => {
98033
+ const stats = s.getRawDataStatisticsByField(this._field);
98034
+ if (!isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.min) || !isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.max)) {
98035
+ fieldLinear = false;
98036
+ }
98037
+ }, {
98038
+ userId: this._seriesUserId,
98039
+ specIndex: this._seriesIndex
98040
+ });
98041
+ }
98042
+ this._stateScale = fieldLinear ? new LinearScale() : new BandScale();
98043
+ this._stateScale.domain(this._computeDomainOfStateScale(fieldLinear), true).range(defaultRange);
97757
98044
  }
97758
- super.updateLayoutAttribute();
98045
+ }
98046
+ _computeDomainOfStateScale(isContinuous) {
98047
+ if (this._spec.customDomain) {
98048
+ return this._spec.customDomain;
98049
+ }
98050
+ const domain = this._data.getLatestData().map((d) => d[this._stateField]);
98051
+ if (isContinuous) {
98052
+ const domainNum = domain.map((n) => n * 1);
98053
+ return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
98054
+ }
98055
+ return domain;
97759
98056
  }
97760
98057
  _autoVisible(isShown) {
97761
98058
  if (!this._auto) {
@@ -97774,29 +98071,6 @@
97774
98071
  [sizeKey]: exports.AttributeLevel.Built_In
97775
98072
  });
97776
98073
  }
97777
- onLayoutStart(layoutRect, viewRect) {
97778
- super.onLayoutStart(layoutRect, viewRect);
97779
- const isShown = this._autoUpdate(layoutRect);
97780
- this._autoVisible(isShown);
97781
- this._dataUpdating = false;
97782
- }
97783
- onLayoutEnd() {
97784
- const isShown = !(this._start === 0 && this._end === 1);
97785
- this._autoVisible(isShown);
97786
- super.onLayoutEnd();
97787
- }
97788
- getBoundsInRect(rect) {
97789
- const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
97790
- if (this._isHorizontal) {
97791
- result.y2 = result.y1 + this._height;
97792
- result.x2 = result.x1 + rect.width;
97793
- }
97794
- else {
97795
- result.x2 = result.x1 + this._width;
97796
- result.y2 = result.y1 + rect.height;
97797
- }
97798
- return result;
97799
- }
97800
98074
  hide() {
97801
98075
  var _a;
97802
98076
  (_a = this._component) === null || _a === void 0 ? void 0 : _a.hideAll();
@@ -97805,15 +98079,6 @@
97805
98079
  var _a;
97806
98080
  (_a = this._component) === null || _a === void 0 ? void 0 : _a.showAll();
97807
98081
  }
97808
- _getAxisBandSize(axisSpec) {
97809
- const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
97810
- const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
97811
- const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
97812
- if (bandSize || minBandSize || maxBandSize) {
97813
- return { bandSize, maxBandSize, minBandSize };
97814
- }
97815
- return undefined;
97816
- }
97817
98082
  _autoUpdate(rect) {
97818
98083
  var _a, _b, _c, _d, _e, _f;
97819
98084
  if (!this._auto) {
@@ -97823,7 +98088,7 @@
97823
98088
  const axis = this._relatedAxisComponent;
97824
98089
  const axisSpec = axis === null || axis === void 0 ? void 0 : axis.getSpec();
97825
98090
  const axisScale = axis === null || axis === void 0 ? void 0 : axis.getScale();
97826
- const bandSizeResult = this._getAxisBandSize(axisSpec);
98091
+ const bandSizeResult = getAxisBandSize(axisSpec);
97827
98092
  if (!this._dataUpdating &&
97828
98093
  isDiscrete(axisScale.type) &&
97829
98094
  (rect === null || rect === void 0 ? void 0 : rect.height) === ((_a = this._cacheRect) === null || _a === void 0 ? void 0 : _a.height) &&
@@ -97870,9 +98135,6 @@
97870
98135
  _getNeedClearVRenderComponents() {
97871
98136
  return [this._component];
97872
98137
  }
97873
- clear() {
97874
- this._throttledHide = null;
97875
- }
97876
98138
  }
97877
98139
  mixin(DataFilterBaseComponent, Zoomable);
97878
98140
 
@@ -98018,14 +98280,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98018
98280
  this.layoutType = 'region-relative';
98019
98281
  this._isReverseCache = false;
98020
98282
  this._dataToPositionX = (datum) => {
98021
- const offsetLeft = this._orient === 'left' ? this._middleHandlerSize : 0;
98283
+ const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
98022
98284
  const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
98023
98285
  const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
98024
98286
  const xField = this._isHorizontal ? this._stateField : this._valueField;
98025
98287
  return xScale.scale(datum[xField]) + this.getLayoutStartPoint().x + offsetLeft + offsetHandler;
98026
98288
  };
98027
98289
  this._dataToPositionX2 = (datum) => {
98028
- const offsetLeft = this._orient === 'left' ? this._middleHandlerSize : 0;
98290
+ const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
98029
98291
  const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
98030
98292
  const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
98031
98293
  const min = xScale.domain()[0];
@@ -98034,63 +98296,146 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98034
98296
  this._dataToPositionY = (datum) => {
98035
98297
  const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
98036
98298
  const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
98037
- const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
98299
+ const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
98038
98300
  const yField = this._isHorizontal ? this._valueField : this._stateField;
98039
98301
  return yScale.scale(datum[yField]) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
98040
98302
  };
98041
98303
  this._dataToPositionY2 = (datum) => {
98042
98304
  const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
98043
98305
  const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
98044
- const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
98306
+ const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
98045
98307
  const min = yScale.domain()[0];
98046
98308
  return yScale.scale(min) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
98047
98309
  };
98048
98310
  this._valueField = 'y';
98049
98311
  this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'filter';
98050
98312
  }
98313
+ _handleChange(start, end, updateComponent, tag) {
98314
+ super._handleChange(start, end, updateComponent);
98315
+ if (this._shouldChange) {
98316
+ if (updateComponent && this._component) {
98317
+ this._component.setStartAndEnd(start, end);
98318
+ }
98319
+ else {
98320
+ const axis = this._relatedAxisComponent;
98321
+ const startValue = statePointToData(start, this._stateScale, isReverse(axis, this._isHorizontal));
98322
+ const endValue = statePointToData(end, this._stateScale, isReverse(axis, this._isHorizontal));
98323
+ if (!isValid$1(startValue) || !isValid$1(endValue)) {
98324
+ return;
98325
+ }
98326
+ this._start = start;
98327
+ this._end = end;
98328
+ const hasChange = isFunction$1(this._spec.updateDataAfterChange)
98329
+ ? this._spec.updateDataAfterChange(start, end, startValue, endValue)
98330
+ : this._handleStateChange(startValue, endValue, tag);
98331
+ if (hasChange) {
98332
+ this.event.emit(exports.ChartEvent.dataZoomChange, {
98333
+ model: this,
98334
+ value: {
98335
+ filterData: this._filterMode !== 'axis',
98336
+ start,
98337
+ end,
98338
+ startValue: this._startValue,
98339
+ endValue: this._endValue,
98340
+ newDomain: this._newDomain
98341
+ }
98342
+ });
98343
+ }
98344
+ }
98345
+ }
98346
+ }
98347
+ _handleDataCollectionChange() {
98348
+ const data = this._data.getDataView();
98349
+ data.reRunAllTransform();
98350
+ const domain = this._computeDomainOfValueScale();
98351
+ if (domain) {
98352
+ if (!this._valueScale) {
98353
+ this._valueScale = new LinearScale();
98354
+ }
98355
+ this._valueScale.domain(domain);
98356
+ this._updateValueScaleRange();
98357
+ if (this._component) {
98358
+ this._createOrUpdateComponent(true);
98359
+ }
98360
+ }
98361
+ }
98051
98362
  created() {
98052
98363
  super.created();
98053
98364
  this._initValueScale();
98054
98365
  }
98366
+ updateLayoutAttribute() {
98367
+ if (this._cacheVisibility !== false) {
98368
+ super.updateLayoutAttribute();
98369
+ }
98370
+ }
98371
+ _beforeLayoutEnd() {
98372
+ super._beforeLayoutEnd();
98373
+ const axis = this._relatedAxisComponent;
98374
+ if ((isReverse(axis, this._isHorizontal) && !this._isReverseCache) || this._auto) {
98375
+ this._isReverseCache = isReverse(axis, this._isHorizontal);
98376
+ this.effect.onZoomChange();
98377
+ }
98378
+ }
98379
+ clear() {
98380
+ if (this._component) {
98381
+ const container = this.getContainer();
98382
+ this._component.removeAllChild();
98383
+ if (container) {
98384
+ container.removeChild(this._component);
98385
+ }
98386
+ this._component = null;
98387
+ }
98388
+ super.clear();
98389
+ }
98390
+ getBoundsInRect(rect) {
98391
+ var _a, _b, _c, _d;
98392
+ const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
98393
+ const startHandlerScaleXSize = this._startHandlerSize * ((_a = this._spec.startHandler.style.scaleX) !== null && _a !== void 0 ? _a : 1);
98394
+ const startHandlerScaleYSize = this._startHandlerSize * ((_b = this._spec.startHandler.style.scaleY) !== null && _b !== void 0 ? _b : 1);
98395
+ const endHandlerScaleXSize = this._endHandlerSize * ((_c = this._spec.endHandler.style.scaleX) !== null && _c !== void 0 ? _c : 1);
98396
+ const endHandlerScaleYSize = this._endHandlerSize * ((_d = this._spec.endHandler.style.scaleY) !== null && _d !== void 0 ? _d : 1);
98397
+ const extendWidth = !this._visible
98398
+ ? 0
98399
+ : this._isHorizontal
98400
+ ? (startHandlerScaleXSize - this._startHandlerSize) / 2 + (endHandlerScaleXSize - this._endHandlerSize) / 2
98401
+ : (Math.max(startHandlerScaleXSize, endHandlerScaleXSize) - this._width) / 2;
98402
+ const extendHeight = !this._visible
98403
+ ? 0
98404
+ : this._isHorizontal
98405
+ ? (Math.max(startHandlerScaleYSize, endHandlerScaleYSize) - this._height) / 2
98406
+ : (startHandlerScaleYSize - this._startHandlerSize) / 2 + (endHandlerScaleYSize - this._endHandlerSize) / 2;
98407
+ if (this._isHorizontal) {
98408
+ result.y2 = result.y1 + this._height + extendHeight;
98409
+ result.x2 = result.x1 + rect.width + extendWidth;
98410
+ }
98411
+ else {
98412
+ result.x2 = result.x1 + this._width + extendWidth;
98413
+ result.y2 = result.y1 + rect.height + extendHeight;
98414
+ }
98415
+ return result;
98416
+ }
98055
98417
  setAttrFromSpec() {
98056
98418
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
98057
98419
  super.setAttrFromSpec();
98058
- if (isBoolean$1(this._spec.roam)) {
98059
- this._zoomAttr.enable = this._spec.roam;
98060
- this._dragAttr.enable = this._spec.roam;
98061
- this._scrollAttr.enable = this._spec.roam;
98062
- }
98063
- if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
98064
- this.initZoomable(this.event, this._option.mode);
98065
- }
98420
+ const componentSize = this._isHorizontal ? Number(this._spec.height) : Number(this._spec.width);
98066
98421
  this._backgroundSize = (_b = (_a = this._spec.background) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 30;
98067
98422
  this._middleHandlerSize = this._computeMiddleHandlerSize();
98068
- this._width = this._computeWidth();
98069
- this._height = this._computeHeight();
98070
98423
  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)) {
98071
- this._spec.startHandler.style.size = this._isHorizontal
98072
- ? this._height - this._middleHandlerSize
98073
- : this._width - this._middleHandlerSize;
98424
+ this._spec.startHandler.style.size = isNaN(componentSize)
98425
+ ? this._backgroundSize
98426
+ : componentSize - this._middleHandlerSize;
98074
98427
  }
98075
98428
  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)) {
98076
- this._spec.endHandler.style.size = this._isHorizontal
98077
- ? this._height - this._middleHandlerSize
98078
- : this._width - this._middleHandlerSize;
98079
- }
98080
- const startHandlerVisble = (_j = this._spec.startHandler.style.visible) !== null && _j !== void 0 ? _j : true;
98081
- const endHandlerVisble = (_k = this._spec.endHandler.style.visible) !== null && _k !== void 0 ? _k : true;
98082
- this._startHandlerSize = startHandlerVisble ? this._spec.startHandler.style.size : 0;
98083
- this._endHandlerSize = endHandlerVisble ? this._spec.endHandler.style.size : 0;
98084
- }
98085
- onLayoutEnd() {
98086
- this._updateScaleRange();
98087
- if (this._isReverse() && !this._isReverseCache) {
98088
- this._isReverseCache = this._isReverse();
98089
- this.effect.onZoomChange();
98090
- }
98091
- if (this._cacheVisibility !== false) {
98092
- super.onLayoutEnd();
98093
- }
98429
+ this._spec.endHandler.style.size = isNaN(componentSize)
98430
+ ? this._backgroundSize
98431
+ : componentSize - this._middleHandlerSize;
98432
+ }
98433
+ const startHandlerVisible = (_j = this._spec.startHandler.style.visible) !== null && _j !== void 0 ? _j : true;
98434
+ const endHandlerVisible = (_k = this._spec.endHandler.style.visible) !== null && _k !== void 0 ? _k : true;
98435
+ this._startHandlerSize = startHandlerVisible ? this._spec.startHandler.style.size : 0;
98436
+ this._endHandlerSize = endHandlerVisible ? this._spec.endHandler.style.size : 0;
98437
+ this._width = this._computeWidth();
98438
+ this._height = this._computeHeight();
98094
98439
  }
98095
98440
  _initValueScale() {
98096
98441
  const domain = this._computeDomainOfValueScale();
@@ -98101,9 +98446,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98101
98446
  }
98102
98447
  }
98103
98448
  _updateScaleRange() {
98104
- var _a, _b;
98449
+ this._updateStateScaleRange();
98450
+ this._updateValueScaleRange();
98451
+ }
98452
+ _updateStateScaleRange() {
98453
+ var _a, _b, _c;
98105
98454
  const handlerSize = this._startHandlerSize + this._endHandlerSize;
98106
- if (!this._stateScale || !this._valueScale) {
98455
+ if (!this._stateScale) {
98107
98456
  return;
98108
98457
  }
98109
98458
  let stateScaleRange;
@@ -98120,14 +98469,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98120
98469
  stateScaleRange = this._visible
98121
98470
  ? [this._startHandlerSize / 2, compWidth - handlerSize + this._startHandlerSize / 2]
98122
98471
  : defaultRange;
98123
- this._stateScale.range(stateScaleRange);
98124
- this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
98125
98472
  }
98126
98473
  else {
98127
98474
  stateScaleRange = this._visible
98128
98475
  ? [this._startHandlerSize / 2, compHeight - handlerSize + this._startHandlerSize / 2]
98129
98476
  : defaultRange;
98130
- this._stateScale.range(stateScaleRange);
98477
+ }
98478
+ this._stateScale.range(stateScaleRange);
98479
+ (_c = this._previewStateScale) === null || _c === void 0 ? void 0 : _c.range(isReverse(this._relatedAxisComponent, this._isHorizontal)
98480
+ ? stateScaleRange.reverse()
98481
+ : stateScaleRange);
98482
+ }
98483
+ _updateValueScaleRange() {
98484
+ if (!this._valueScale) {
98485
+ return;
98486
+ }
98487
+ const compWidth = this._computeWidth();
98488
+ const compHeight = this._computeHeight();
98489
+ if (this._isHorizontal) {
98490
+ this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
98491
+ }
98492
+ else {
98131
98493
  if (this.layoutOrient === 'left') {
98132
98494
  this._valueScale.range([compWidth - this._middleHandlerSize, 0]);
98133
98495
  }
@@ -98135,24 +98497,35 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98135
98497
  this._valueScale.range([0, compWidth - this._middleHandlerSize]);
98136
98498
  }
98137
98499
  }
98138
- if (this._component && this._cacheVisibility !== false) {
98139
- this._component.setAttributes({
98140
- size: {
98141
- width: compWidth,
98142
- height: compHeight
98143
- },
98144
- position: {
98145
- x: this.getLayoutStartPoint().x,
98146
- y: this.getLayoutStartPoint().y
98147
- }
98148
- });
98149
- }
98150
98500
  }
98151
98501
  _computeDomainOfValueScale() {
98152
98502
  const domain = this._data.getLatestData().map((d) => d[this._valueField]);
98153
98503
  const domainNum = domain.map((n) => n * 1);
98154
98504
  return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : null;
98155
98505
  }
98506
+ _isScaleValid(scale) {
98507
+ if (!scale || !scale.domain()) {
98508
+ return false;
98509
+ }
98510
+ const domain = scale.domain();
98511
+ if (isContinuous(scale.type) && domain[0] === last(domain)) {
98512
+ return false;
98513
+ }
98514
+ if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
98515
+ return false;
98516
+ }
98517
+ return true;
98518
+ }
98519
+ _getXScale() {
98520
+ const bindScale = this._relatedAxisComponent.getScale();
98521
+ if (bindScale.type === this.stateScale.type && this._isHorizontal) {
98522
+ return this.stateScale;
98523
+ }
98524
+ return this._isHorizontal ? this._stateScale : this._valueScale;
98525
+ }
98526
+ _getYScale() {
98527
+ return this._isHorizontal ? this._valueScale : this._stateScale;
98528
+ }
98156
98529
  _computeMiddleHandlerSize() {
98157
98530
  var _a, _b, _c, _d;
98158
98531
  let size = 0;
@@ -98173,7 +98546,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98173
98546
  if (this._isHorizontal) {
98174
98547
  return this.getLayoutRect().width;
98175
98548
  }
98176
- return this._backgroundSize + this._middleHandlerSize;
98549
+ return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
98550
+ this._middleHandlerSize);
98177
98551
  }
98178
98552
  _computeHeight() {
98179
98553
  if (this._visible === false) {
@@ -98183,23 +98557,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98183
98557
  return this._spec.height;
98184
98558
  }
98185
98559
  if (this._isHorizontal) {
98186
- return this._backgroundSize + this._middleHandlerSize;
98560
+ return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
98561
+ this._middleHandlerSize);
98187
98562
  }
98188
98563
  return this.getLayoutRect().height;
98189
98564
  }
98190
- _isScaleValid(scale) {
98191
- if (!scale || !scale.domain()) {
98192
- return false;
98193
- }
98194
- const domain = scale.domain();
98195
- if (isContinuous(scale.type) && domain[0] === last(domain)) {
98196
- return false;
98197
- }
98198
- if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
98199
- return false;
98200
- }
98201
- return true;
98202
- }
98203
98565
  _getAttrs(isNeedPreview) {
98204
98566
  var _a, _b, _c, _d, _e;
98205
98567
  const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : {};
@@ -98209,73 +98571,58 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98209
98571
  }, orient: this._orient, size: {
98210
98572
  width: this._computeWidth(),
98211
98573
  height: this._computeHeight()
98212
- }, 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));
98574
+ }, 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));
98213
98575
  }
98214
- _createOrUpdateComponent() {
98576
+ _getLayoutAttrs() {
98577
+ return {
98578
+ position: {
98579
+ x: this.getLayoutStartPoint().x,
98580
+ y: this.getLayoutStartPoint().y
98581
+ },
98582
+ size: {
98583
+ width: this._computeWidth(),
98584
+ height: this._computeHeight()
98585
+ }
98586
+ };
98587
+ }
98588
+ _createOrUpdateComponent(changeData) {
98215
98589
  if (this._visible) {
98216
98590
  const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
98217
98591
  const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
98218
98592
  const isNeedPreview = this._isScaleValid(xScale) && this._isScaleValid(yScale) && this._spec.showBackgroundChart !== false;
98219
98593
  const attrs = this._getAttrs(isNeedPreview);
98594
+ const axis = this._relatedAxisComponent;
98220
98595
  if (this._component) {
98221
98596
  this._component.setAttributes(attrs);
98597
+ if (changeData) {
98598
+ this._component.setPreviewData(this._data.getDataView().latestData);
98599
+ if (isNeedPreview) {
98600
+ if (this._isHorizontal) {
98601
+ this._component.setPreviewPointsY1(this._dataToPositionY2);
98602
+ }
98603
+ else {
98604
+ this._component.setPreviewPointsX1(this._dataToPositionX2);
98605
+ }
98606
+ this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
98607
+ }
98608
+ }
98222
98609
  }
98223
98610
  else {
98224
98611
  const container = this.getContainer();
98225
98612
  this._component = new DataZoom$1(attrs);
98613
+ this._component.setPreviewData(this._data.getDataView().latestData);
98226
98614
  if (this._isHorizontal) {
98227
98615
  isNeedPreview && this._component.setPreviewPointsY1(this._dataToPositionY2);
98228
98616
  }
98229
98617
  else {
98230
98618
  isNeedPreview && this._component.setPreviewPointsX1(this._dataToPositionX2);
98231
98619
  }
98232
- this._component.setStatePointToData((state) => this.statePointToData(state));
98233
- this._component.addEventListener('change', (e) => {
98620
+ this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
98621
+ this._component.addEventListener('dataZoomChange', (e) => {
98234
98622
  const { start, end, tag } = e.detail;
98235
98623
  this._handleChange(start, end, undefined, tag);
98236
98624
  });
98237
98625
  container.add(this._component);
98238
- this._updateScaleRange();
98239
- }
98240
- }
98241
- }
98242
- _handleChange(start, end, updateComponent, tag) {
98243
- super._handleChange(start, end, updateComponent);
98244
- if (this._shouldChange) {
98245
- if (updateComponent && this._component) {
98246
- this._component.setStartAndEnd(start, end);
98247
- }
98248
- this._start = start;
98249
- this._end = end;
98250
- const startValue = this.statePointToData(start);
98251
- const endValue = this.statePointToData(end);
98252
- const hasChange = isFunction$1(this._spec.updateDataAfterChange)
98253
- ? this._spec.updateDataAfterChange(start, end, startValue, endValue)
98254
- : this._handleStateChange(startValue, endValue, tag);
98255
- if (hasChange) {
98256
- this.event.emit(exports.ChartEvent.dataZoomChange, {
98257
- model: this,
98258
- value: {
98259
- filterData: this._filterMode !== 'axis',
98260
- start,
98261
- end,
98262
- startValue: this._startValue,
98263
- endValue: this._endValue,
98264
- newDomain: this._newDomain
98265
- }
98266
- });
98267
- }
98268
- }
98269
- }
98270
- _handleDataCollectionChange() {
98271
- var _a;
98272
- const data = this._data.getDataView();
98273
- data.reRunAllTransform();
98274
- (_a = this._component) === null || _a === void 0 ? void 0 : _a.setPreviewData(data.latestData);
98275
- if (this._valueScale) {
98276
- const domain = this._computeDomainOfValueScale();
98277
- if (domain) {
98278
- this._valueScale.domain(domain);
98279
98626
  }
98280
98627
  }
98281
98628
  }
@@ -98337,16 +98684,23 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98337
98684
  _getNeedClearVRenderComponents() {
98338
98685
  return [this._component];
98339
98686
  }
98340
- clear() {
98341
- if (this._component) {
98342
- const container = this.getContainer();
98343
- this._component.removeAllChild();
98344
- if (container) {
98345
- container.removeChild(this._component);
98687
+ onDataUpdate() {
98688
+ super.onDataUpdate();
98689
+ if (this._previewStateScale !== this._stateScale) {
98690
+ this._previewStateScale = null;
98691
+ }
98692
+ }
98693
+ _getPreviewStateScale() {
98694
+ if (!this._previewStateScale) {
98695
+ if (isReverse(this._relatedAxisComponent, this._isHorizontal)) {
98696
+ this._previewStateScale = this._stateScale.clone();
98697
+ this._previewStateScale.range(this._stateScale.range().reverse());
98698
+ }
98699
+ else {
98700
+ this._previewStateScale = this._stateScale;
98346
98701
  }
98347
- this._component = null;
98348
98702
  }
98349
- super.clear();
98703
+ return this._previewStateScale;
98350
98704
  }
98351
98705
  }
98352
98706
  DataZoom.type = ComponentTypeEnum.dataZoom;
@@ -98391,24 +98745,53 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98391
98745
  this.layoutType = 'region-relative';
98392
98746
  this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'axis';
98393
98747
  }
98394
- setAttrFromSpec() {
98395
- super.setAttrFromSpec();
98396
- if (isBoolean$1(this._spec.roam)) {
98397
- this._zoomAttr.enable = false;
98398
- this._dragAttr.enable = this._spec.roam;
98399
- this._scrollAttr.enable = this._spec.roam;
98748
+ _handleChange(start, end, updateComponent) {
98749
+ super._handleChange(start, end, updateComponent);
98750
+ const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
98751
+ if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
98752
+ if (updateComponent && this._component) {
98753
+ this._component.setAttribute('range', [start, end]);
98754
+ }
98755
+ this._start = start;
98756
+ this._end = end;
98757
+ const startValue = statePointToData(start, this._stateScale, false);
98758
+ const endValue = statePointToData(end, this._stateScale, false);
98759
+ const hasChange = isFunction$1(this._spec.updateDataAfterChange)
98760
+ ? this._spec.updateDataAfterChange(start, end, startValue, endValue)
98761
+ : this._handleStateChange(startValue, endValue);
98762
+ if (hasChange) {
98763
+ this.event.emit(exports.ChartEvent.scrollBarChange, {
98764
+ model: this,
98765
+ value: {
98766
+ filterData: this._filterMode !== 'axis',
98767
+ start: this._start,
98768
+ end: this._end,
98769
+ startValue: this._startValue,
98770
+ endValue: this._endValue,
98771
+ newDomain: this._newDomain
98772
+ }
98773
+ });
98774
+ }
98400
98775
  }
98401
- if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
98402
- this.initZoomable(this.event, this._option.mode);
98776
+ }
98777
+ _handleDataCollectionChange() {
98778
+ if (this._spec.auto) {
98779
+ const data = this._data.getDataView();
98780
+ data.reRunAllTransform();
98403
98781
  }
98404
98782
  }
98405
- onLayoutEnd() {
98783
+ _beforeLayoutEnd() {
98406
98784
  var _a, _b;
98407
- this._updateScaleRange();
98785
+ super._beforeLayoutEnd();
98408
98786
  (_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a);
98787
+ }
98788
+ onLayoutEnd() {
98789
+ this._updateComponentBounds();
98409
98790
  super.onLayoutEnd();
98410
98791
  }
98411
98792
  _updateScaleRange() {
98793
+ }
98794
+ _updateComponentBounds() {
98412
98795
  if (this._component) {
98413
98796
  this._component.setAttributes({
98414
98797
  x: this.getLayoutStartPoint().x,
@@ -98419,6 +98802,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98419
98802
  }
98420
98803
  }
98421
98804
  _computeWidth() {
98805
+ if (this._visible === false) {
98806
+ return 0;
98807
+ }
98422
98808
  if (isNumber$1(this._spec.width)) {
98423
98809
  return this._spec.width;
98424
98810
  }
@@ -98428,6 +98814,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98428
98814
  return SCROLL_BAR_DEFAULT_SIZE;
98429
98815
  }
98430
98816
  _computeHeight() {
98817
+ if (this._visible === false) {
98818
+ return 0;
98819
+ }
98431
98820
  if (isNumber$1(this._spec.height)) {
98432
98821
  return this._spec.height;
98433
98822
  }
@@ -98438,7 +98827,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98438
98827
  }
98439
98828
  _getAttrs() {
98440
98829
  var _a, _b, _c, _d, _e, _f;
98441
- 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());
98830
+ 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());
98442
98831
  }
98443
98832
  _createOrUpdateComponent() {
98444
98833
  const attrs = this._getAttrs();
@@ -98459,41 +98848,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98459
98848
  container.add(this._component);
98460
98849
  }
98461
98850
  }
98462
- _handleChange(start, end, updateComponent) {
98463
- super._handleChange(start, end, updateComponent);
98464
- const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
98465
- if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
98466
- if (updateComponent && this._component) {
98467
- this._component.setAttribute('range', [start, end]);
98468
- }
98469
- this._start = start;
98470
- this._end = end;
98471
- const startValue = this.statePointToData(start);
98472
- const endValue = this.statePointToData(end);
98473
- const hasChange = isFunction$1(this._spec.updateDataAfterChange)
98474
- ? this._spec.updateDataAfterChange(start, end, startValue, endValue)
98475
- : this._handleStateChange(this.statePointToData(start), this.statePointToData(end));
98476
- if (hasChange) {
98477
- this.event.emit(exports.ChartEvent.scrollBarChange, {
98478
- model: this,
98479
- value: {
98480
- filterData: this._filterMode !== 'axis',
98481
- start: this._start,
98482
- end: this._end,
98483
- startValue: this._startValue,
98484
- endValue: this._endValue,
98485
- newDomain: this._newDomain
98486
- }
98487
- });
98488
- }
98489
- }
98490
- }
98491
- _handleDataCollectionChange() {
98492
- if (this._spec.auto) {
98493
- const data = this._data.getDataView();
98494
- data.reRunAllTransform();
98495
- }
98496
- }
98497
98851
  _getComponentAttrs() {
98498
98852
  const { rail, slider, innerPadding } = this._spec;
98499
98853
  const attrs = {};
@@ -98850,7 +99204,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98850
99204
  const lines = [];
98851
99205
  const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
98852
99206
  const xAxisHelper = relativeSeries.getXAxisHelper();
98853
- const yAxisHelper = relativeSeries.getXAxisHelper();
99207
+ const yAxisHelper = relativeSeries.getYAxisHelper();
98854
99208
  const xDomain = xAxisHelper.getScale(0).domain();
98855
99209
  const yDomain = yAxisHelper.getScale(0).domain();
98856
99210
  const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
@@ -102629,17 +102983,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
102629
102983
  const axisRangeExpand = (_a = this._spec.axisRangeExpand) !== null && _a !== void 0 ? _a : 0;
102630
102984
  const { x1, x2, y1, y2 } = operateMaskBounds;
102631
102985
  const regionStartAttr = isHorizontal ? 'x' : 'y';
102986
+ const regionSizeAttr = isHorizontal ? 'width' : 'height';
102632
102987
  const boundsStart = isHorizontal ? x1 : y1;
102633
102988
  const boundsEnd = isHorizontal ? x2 : y2;
102634
102989
  if (this._axisDataZoomMap[axis.id]) {
102635
102990
  const dataZoom = this._axisDataZoomMap[axis.id];
102636
- const releatedAxis = dataZoom.relatedAxisComponent;
102637
- const startValue = releatedAxis
102638
- .getScale()
102639
- .invert(boundsStart - region.getLayoutStartPoint()[regionStartAttr]);
102640
- const endValue = releatedAxis.getScale().invert(boundsEnd - region.getLayoutStartPoint()[regionStartAttr]);
102641
- const startPercent = dataZoom.dataToStatePoint(startValue);
102642
- const endPercent = dataZoom.dataToStatePoint(endValue);
102991
+ const startPercent = (boundsStart - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
102992
+ const endPercent = (boundsEnd - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
102643
102993
  const newStartPercent = this._stateClamp(startPercent - axisRangeExpand);
102644
102994
  const newEndPercent = this._stateClamp(endPercent + axisRangeExpand);
102645
102995
  dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), [
@@ -102650,8 +103000,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
102650
103000
  operateComponent: dataZoom,
102651
103001
  start: newStartPercent,
102652
103002
  end: newEndPercent,
102653
- startValue: dataZoom.statePointToData(newStartPercent),
102654
- endValue: dataZoom.statePointToData(newEndPercent)
103003
+ startValue: statePointToData(newStartPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal)),
103004
+ endValue: statePointToData(newEndPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal))
102655
103005
  });
102656
103006
  }
102657
103007
  else {