@visactor/vchart 1.2.0-beta.6 → 1.2.0

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 (37) hide show
  1. package/build/index.js +181 -103
  2. package/build/index.min.js +1 -1
  3. package/cjs/component/axis/base-axis.d.ts +2 -0
  4. package/cjs/component/axis/base-axis.js +4 -2
  5. package/cjs/component/axis/base-axis.js.map +1 -1
  6. package/cjs/component/axis/polar/axis.js +4 -3
  7. package/cjs/component/axis/polar/axis.js.map +1 -1
  8. package/cjs/component/brush/brush.d.ts +6 -3
  9. package/cjs/component/brush/brush.js +56 -37
  10. package/cjs/component/brush/brush.js.map +1 -1
  11. package/cjs/component/brush/interface.d.ts +11 -8
  12. package/cjs/component/brush/interface.js +1 -7
  13. package/cjs/component/brush/interface.js.map +1 -1
  14. package/cjs/core/index.d.ts +1 -1
  15. package/cjs/core/index.js +1 -1
  16. package/cjs/core/index.js.map +1 -1
  17. package/cjs/event/events/dimension/util/cartesian.js +18 -11
  18. package/cjs/event/events/dimension/util/cartesian.js.map +1 -1
  19. package/cjs/typings/spec/common.js.map +1 -1
  20. package/esm/component/axis/base-axis.d.ts +2 -0
  21. package/esm/component/axis/base-axis.js +4 -2
  22. package/esm/component/axis/base-axis.js.map +1 -1
  23. package/esm/component/axis/polar/axis.js +4 -2
  24. package/esm/component/axis/polar/axis.js.map +1 -1
  25. package/esm/component/brush/brush.d.ts +6 -3
  26. package/esm/component/brush/brush.js +56 -37
  27. package/esm/component/brush/brush.js.map +1 -1
  28. package/esm/component/brush/interface.d.ts +11 -8
  29. package/esm/component/brush/interface.js +1 -7
  30. package/esm/component/brush/interface.js.map +1 -1
  31. package/esm/core/index.d.ts +1 -1
  32. package/esm/core/index.js +1 -1
  33. package/esm/core/index.js.map +1 -1
  34. package/esm/event/events/dimension/util/cartesian.js +19 -8
  35. package/esm/event/events/dimension/util/cartesian.js.map +1 -1
  36. package/esm/typings/spec/common.js.map +1 -1
  37. package/package.json +2 -2
package/build/index.js CHANGED
@@ -19669,7 +19669,7 @@
19669
19669
  clearTimeout(h);
19670
19670
  }
19671
19671
  appendDuration(d) {
19672
- this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1e3 / 60);
19672
+ this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.min(Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1e3 / 60), 1e3 / 30);
19673
19673
  }
19674
19674
  }
19675
19675
  RafBasedSTO.TimeOut = 1e3 / 60;
@@ -22986,7 +22986,8 @@
22986
22986
  return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
22987
22987
  }
22988
22988
  function textLayoutOffsetY(baseline, lineHeight, fontSize) {
22989
- return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? -lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
22989
+ let buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
22990
+ return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
22990
22991
  }
22991
22992
 
22992
22993
  class CanvasTextLayout {
@@ -23137,8 +23138,7 @@
23137
23138
  const textTheme = getTheme(this).text,
23138
23139
  textMeasure = application.graphicUtil.textMeasure;
23139
23140
  let width, str;
23140
- const buf = 2,
23141
- attribute = this.attribute,
23141
+ const attribute = this.attribute,
23142
23142
  {
23143
23143
  maxLineWidth = textTheme.maxLineWidth,
23144
23144
  ellipsis = textTheme.ellipsis,
@@ -23147,8 +23147,11 @@
23147
23147
  fontSize = textTheme.fontSize,
23148
23148
  fontWeight = textTheme.fontWeight,
23149
23149
  stroke = textTheme.stroke,
23150
- lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf,
23151
23150
  lineWidth = textTheme.lineWidth
23151
+ } = attribute,
23152
+ buf = Math.max(2, .075 * fontSize),
23153
+ {
23154
+ lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf
23152
23155
  } = attribute;
23153
23156
  if (!this.shouldUpdateShape() && this.cache) {
23154
23157
  width = this.cache.clipedWidth;
@@ -23178,7 +23181,7 @@
23178
23181
  }), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
23179
23182
  this.clearUpdateShapeTag();
23180
23183
  const dx = textDrawOffsetX(textAlign, width),
23181
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
23184
+ dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize, 0);
23182
23185
  return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
23183
23186
  }
23184
23187
  updateMultilineAABBBounds(text) {
@@ -36285,11 +36288,14 @@
36285
36288
  return prevKeys.length === nextKeys.length && prevKeys.every(key => "stops" === key ? isStopsEqual(prev[key], next[key]) : prev[key] === next[key]);
36286
36289
  },
36287
36290
  isLineDashEqual = (prev, next) => prev.length === next.length && prev.join("-") === next.join("-"),
36288
- isSegmentAttrEqual = (prev, next, key) => !(!isNil(prev) || !isNil(next)) || !isNil(prev) && !isNil(next) && ("lineDash" === key ? isLineDashEqual(prev, next) : "stroke" === key ? isColorAttrEqual(prev, next) : prev === next);
36291
+ isSegmentAttrEqual = (prev, next, key) => !(!isNil(prev) || !isNil(next)) || !isNil(prev) && !isNil(next) && ("lineDash" === key ? isLineDashEqual(prev, next) : "stroke" === key || "fill" === key ? isColorAttrEqual(prev, next) : prev === next),
36292
+ fillAttrs = ["fill", "fillOpacity", "background", "texture", "texturePadding", "textureSize", "textureColor"],
36293
+ strokeAttrs = ["stroke", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "lineWidth", "miterLimit"],
36294
+ areaAttrs = fillAttrs.concat(strokeAttrs);
36289
36295
  function getLineSegmentConfigs(items, points, element) {
36290
36296
  var _a;
36291
36297
  if (!items || items.length <= 1) return null;
36292
- const checkAttributes = "area" === (null === (_a = null == element ? void 0 : element.mark) || void 0 === _a ? void 0 : _a.markType) ? ["fill", "fillOpacity", "background", "texture", "texturePadding", "textureSize", "textureColor"] : ["stroke", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "lineWidth", "miterLimit"],
36298
+ const checkAttributes = "area" === (null === (_a = null == element ? void 0 : element.mark) || void 0 === _a ? void 0 : _a.markType) ? areaAttrs : strokeAttrs,
36293
36299
  segments = [];
36294
36300
  let prevSegmentAttrs = null;
36295
36301
  return items.forEach((item, index) => {
@@ -42547,7 +42553,7 @@
42547
42553
  }
42548
42554
  getTextAlign(vector) {
42549
42555
  let align = "center";
42550
- return isNumberClose(vector[0], 0) ? align = "center" : vector[0] > 0 ? align = "start" : vector[0] < 0 && (align = "end"), align;
42556
+ return isNumberClose(vector[0], 0) ? isNumberClose(vector[1], 0) ? Object.is(vector[1], -0) ? align = "start" : Object.is(vector[0], -0) && (align = "end") : align = "center" : vector[0] > 0 ? align = "start" : vector[0] < 0 && (align = "end"), align;
42551
42557
  }
42552
42558
  getTickLineItems() {
42553
42559
  const {
@@ -42656,7 +42662,7 @@
42656
42662
  layer > 0 && (0 === axisVector[1] ? offset += (this.axisLabelLayerSize[layer - 1].height + get$1(this.attribute, "label.space", 4)) * layer : offset += (this.axisLabelLayerSize[layer - 1].width + get$1(this.attribute, "label.space", 4)) * layer);
42657
42663
  const point = this.getVerticalCoord(tickDatum.point, offset, inside),
42658
42664
  vector = this.getVerticalVector(offset, inside, point),
42659
- text = formatMethod ? formatMethod(tickDatum.label, tickDatum, index, tickData, layer) : tickDatum.label;
42665
+ text = formatMethod ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer) : tickDatum.label;
42660
42666
  let {
42661
42667
  style: textStyle
42662
42668
  } = tagAttributes;
@@ -42831,10 +42837,12 @@
42831
42837
  orient: orient
42832
42838
  } = config;
42833
42839
  !isEmpty(labels) && isValidNumber(limitLength) && labels.forEach(label => {
42834
- const limitLabelLength = 0 === label.attribute.angle || isNil(label.attribute.angle) ? "top" === orient || "bottom" === orient ? null : limitLength : Math.abs(limitLength / Math.sin(label.attribute.angle));
42835
- label.setAttributes({
42840
+ if (("top" === orient || "bottom" === orient) && Math.floor(label.AABBBounds.height()) <= limitLength) return;
42841
+ if (("left" === orient || "right" === orient) && Math.floor(label.AABBBounds.width()) <= limitLength) return;
42842
+ let limitLabelLength = 0 === label.attribute.angle || isNil(label.attribute.angle) ? "top" === orient || "bottom" === orient ? null : limitLength : Math.abs(limitLength / Math.sin(label.attribute.angle));
42843
+ isValidNumber(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth), label.setAttributes({
42836
42844
  maxLineWidth: limitLabelLength,
42837
- ellipsis: ellipsis
42845
+ ellipsis: label.attribute.ellipsis || ellipsis
42838
42846
  });
42839
42847
  });
42840
42848
  }
@@ -43099,7 +43107,7 @@
43099
43107
  verticalFactor = 1
43100
43108
  } = this.attribute,
43101
43109
  factor = (inside ? 1 : -1) * verticalFactor;
43102
- return isNumberClose(vector[1], 0) ? base = isNumberClose(vector[0], 0) ? 1 === factor ? "bottom" : "top" : "middle" : vector[1] > 0 ? base = "top" : vector[1] < 0 && (base = "bottom"), base;
43110
+ return isNumberClose(vector[1], 0) ? base = !isNumberClose(vector[0], 0) || Object.is(vector[0], -0) || Object.is(vector[1], -0) ? "middle" : 1 === factor ? "bottom" : "top" : vector[1] > 0 ? base = "top" : vector[1] < 0 && (base = "bottom"), base;
43103
43111
  }
43104
43112
  handleLabelsOverlap(labelShapes, labelData, layer, layerCount) {
43105
43113
  var _a, _b, _c;
@@ -46866,6 +46874,11 @@
46866
46874
  }
46867
46875
  }
46868
46876
 
46877
+ var IOperateType;
46878
+ !function (IOperateType) {
46879
+ IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing", IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd", IOperateType.brushClear = "brushClear";
46880
+ }(IOperateType || (IOperateType = {}));
46881
+
46869
46882
  const DEFAULT_BRUSH_ATTRIBUTES = {
46870
46883
  brushMode: "single",
46871
46884
  brushType: "rect",
@@ -46886,6 +46899,7 @@
46886
46899
  x2: 1 / 0
46887
46900
  }
46888
46901
  };
46902
+ const DEFAULT_SIZE_THRESHOLD = 5;
46889
46903
 
46890
46904
  const delayMap = {
46891
46905
  debounce: debounce,
@@ -46893,7 +46907,7 @@
46893
46907
  };
46894
46908
  let Brush$1 = class Brush extends AbstractComponent {
46895
46909
  constructor(attributes) {
46896
- super(merge$2({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._onBrushStart = e => {
46910
+ super(merge$2({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeDrawState = !1, this._cacheDrawPoints = [], this._isDrawedBeforeEnd = !1, this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._onBrushStart = e => {
46897
46911
  var _a, _b;
46898
46912
  if (this._outOfInteractiveRange(e)) return;
46899
46913
  const brushMoved = null === (_b = null === (_a = this.attribute) || void 0 === _a ? void 0 : _a.brushMoved) || void 0 === _b || _b;
@@ -46901,11 +46915,19 @@
46901
46915
  }, this._onBrushing = e => {
46902
46916
  this._outOfInteractiveRange(e) || (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e));
46903
46917
  }, this._onBrushEnd = e => {
46904
- this._outOfInteractiveRange(e) || (this._updateDragMaskCallback && this._updateDragMaskCallback({
46905
- operateType: this._activeDrawState ? "brushEnd" : "brushMaskUp",
46918
+ var _a;
46919
+ const {
46920
+ removeOnClick = !0
46921
+ } = this.attribute;
46922
+ this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick ? (this._container.incrementalClearChild(), this._updateDragMaskCallback && this._updateDragMaskCallback({
46923
+ operateType: IOperateType.brushClear,
46924
+ operateMask: this._operatingMask,
46925
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
46926
+ })) : this._outOfInteractiveRange(e) || this._updateDragMaskCallback && this._updateDragMaskCallback({
46927
+ operateType: this._activeDrawState ? IOperateType.drawEnd : IOperateType.moveEnd,
46906
46928
  operateMask: this._operatingMask,
46907
46929
  operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
46908
- }), this._activeDrawState = !1, this._activeMoveState = !1, this._operatingMask.setAttribute("pickable", !1));
46930
+ }), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, null === (_a = this._operatingMask) || void 0 === _a || _a.setAttribute("pickable", !1);
46909
46931
  };
46910
46932
  }
46911
46933
  bindBrushEvents() {
@@ -46934,12 +46956,11 @@
46934
46956
  }
46935
46957
  _initDraw(e) {
46936
46958
  const {
46937
- brushMode: brushMode,
46938
- removeOnClick: removeOnClick
46959
+ brushMode: brushMode
46939
46960
  } = this.attribute,
46940
46961
  pos = this.eventPosToStagePos(e);
46941
- this._cacheDrawPoints = [pos], this._operatingMask || this._addBrushMask(), "single" === brushMode && removeOnClick ? (this._container.incrementalClearChild(), this._addBrushMask()) : "multiple" === brushMode && this._addBrushMask(), this._updateDragMaskCallback && this._updateDragMaskCallback({
46942
- operateType: "brushStart",
46962
+ this._cacheDrawPoints = [pos], this._isDrawedBeforeEnd = !1, "single" === brushMode && this._container.incrementalClearChild(), this._addBrushMask(), this._updateDragMaskCallback && this._updateDragMaskCallback({
46963
+ operateType: IOperateType.drawStart,
46943
46964
  operateMask: this._operatingMask,
46944
46965
  operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
46945
46966
  });
@@ -46967,21 +46988,31 @@
46967
46988
  minMoveStepY = minY - y1,
46968
46989
  maxMoveStepY = maxY - y2;
46969
46990
  this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX], this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY], this._operatingMask.setAttribute("pickable", !0), this._updateDragMaskCallback && this._updateDragMaskCallback({
46970
- operateType: "brushMaskDown",
46991
+ operateType: IOperateType.moveStart,
46971
46992
  operateMask: this._operatingMask,
46972
46993
  operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
46973
46994
  });
46974
46995
  }
46975
46996
  _drawing(e) {
46976
- const pos = this.eventPosToStagePos(e);
46977
- if (this._cacheDrawPoints.length > 0) {
46997
+ var _a;
46998
+ const pos = this.eventPosToStagePos(e),
46999
+ {
47000
+ x1 = 0,
47001
+ x2 = 0,
47002
+ y1 = 0,
47003
+ y2 = 0
47004
+ } = null === (_a = this._operatingMask) || void 0 === _a ? void 0 : _a._AABBBounds,
47005
+ {
47006
+ sizeThreshold = DEFAULT_SIZE_THRESHOLD
47007
+ } = this.attribute;
47008
+ if (this._isDrawedBeforeEnd = !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold), this._cacheDrawPoints.length > 0) {
46978
47009
  const lastPos = this._cacheDrawPoints[this._cacheDrawPoints.length - 1];
46979
47010
  if (pos.x === (null == lastPos ? void 0 : lastPos.x) && pos.y === (null == lastPos ? void 0 : lastPos.y)) return;
46980
47011
  }
46981
47012
  this._cacheDrawPoints.push(pos);
46982
47013
  const maskPoints = this._computeMaskPoints();
46983
47014
  this._operatingMask.setAttribute("points", maskPoints), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._updateDragMaskCallback && this._updateDragMaskCallback({
46984
- operateType: "brushing",
47015
+ operateType: IOperateType.drawing,
46985
47016
  operateMask: this._operatingMask,
46986
47017
  operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
46987
47018
  });
@@ -46998,7 +47029,7 @@
46998
47029
  dx: moveX,
46999
47030
  dy: moveY
47000
47031
  }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._updateDragMaskCallback && this._updateDragMaskCallback({
47001
- operateType: "brushMaskMove",
47032
+ operateType: IOperateType.moving,
47002
47033
  operateMask: this._operatingMask,
47003
47034
  operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
47004
47035
  });
@@ -53471,22 +53502,45 @@
53471
53502
  return null;
53472
53503
  }
53473
53504
  const { x, y } = pos;
53474
- const xAxisList = getAxis$1(chart, 'x', pos);
53475
- const yAxisList = getAxis$1(chart, 'y', pos);
53505
+ const xAxisList = getAxis$1(chart, 'x', pos) ?? [];
53506
+ const yAxisList = getAxis$1(chart, 'y', pos) ?? [];
53507
+ const bandAxisSet = new Set();
53508
+ const linearAxisSet = new Set();
53509
+ [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
53510
+ const isDiscreteAxis = isDiscrete(axis.getScale().type);
53511
+ if (isDiscreteAxis) {
53512
+ bandAxisSet.add(axis);
53513
+ }
53514
+ else {
53515
+ linearAxisSet.add(axis);
53516
+ }
53517
+ }));
53476
53518
  const targetAxisInfo = [];
53477
- if (xAxisList) {
53478
- xAxisList.forEach(axis => {
53479
- const isDiscreteAxis = isDiscrete(axis.getScale().type);
53480
- const info = getDimensionInfoByPosition(axis, x, 'x', isDiscreteAxis ? discreteXAxisGetDimensionField : continuousXAxisGetDimensionField);
53481
- info && targetAxisInfo.push(info);
53519
+ const addAxisDimensionInfo = (orient, isDiscrete) => {
53520
+ (orient === 'x' ? xAxisList : yAxisList).forEach(axis => {
53521
+ if ((isDiscrete ? bandAxisSet : linearAxisSet).has(axis)) {
53522
+ const info = getDimensionInfoByPosition(axis, orient === 'x' ? x : y, orient, orient === 'x'
53523
+ ? isDiscrete
53524
+ ? discreteXAxisGetDimensionField
53525
+ : continuousXAxisGetDimensionField
53526
+ : isDiscrete
53527
+ ? discreteYAxisGetDimensionField
53528
+ : continuousYAxisGetDimensionField);
53529
+ info && targetAxisInfo.push(info);
53530
+ }
53482
53531
  });
53532
+ };
53533
+ if (chart.getSpec().direction === Direction$2.horizontal) {
53534
+ addAxisDimensionInfo('y', bandAxisSet.size > 0);
53535
+ if (targetAxisInfo.length === 0) {
53536
+ addAxisDimensionInfo('x', bandAxisSet.size > 0);
53537
+ }
53483
53538
  }
53484
- if (yAxisList) {
53485
- yAxisList.forEach(axis => {
53486
- const isDiscreteAxis = isDiscrete(axis.getScale().type);
53487
- const info = getDimensionInfoByPosition(axis, y, 'y', isDiscreteAxis ? discreteYAxisGetDimensionField : continuousYAxisGetDimensionField);
53488
- info && targetAxisInfo.push(info);
53489
- });
53539
+ else {
53540
+ addAxisDimensionInfo('x', bandAxisSet.size > 0);
53541
+ if (targetAxisInfo.length === 0) {
53542
+ addAxisDimensionInfo('y', bandAxisSet.size > 0);
53543
+ }
53490
53544
  }
53491
53545
  if (!targetAxisInfo.length) {
53492
53546
  return null;
@@ -58290,7 +58344,7 @@
58290
58344
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58291
58345
  Factory.registerRegion('region', Region);
58292
58346
  Factory.registerLayout('base', Layout);
58293
- const version = "1.2.0-beta.6";
58347
+ const version = "1.2.0";
58294
58348
  Logger.getInstance(LoggerLevel.Error);
58295
58349
 
58296
58350
  var SeriesMarkNameEnum;
@@ -78932,7 +78986,9 @@
78932
78986
  _outOfBrushElementsMap = {};
78933
78987
  _linkedInBrushElementsMap = {};
78934
78988
  _linkedOutOfBrushElementsMap = {};
78989
+ _needInitOutState = true;
78935
78990
  _isFristState = true;
78991
+ _cacheInteractiveRangeAttrs = [];
78936
78992
  static createComponent(spec, options) {
78937
78993
  const brushSpec = spec.brush || options.defaultSpec;
78938
78994
  if (isNil(brushSpec) || brushSpec.visible === false) {
@@ -78963,14 +79019,12 @@
78963
79019
  }
78964
79020
  return data;
78965
79021
  }
78966
- _createBrushComponent(region, componentIndex) {
79022
+ _getBrushInteractiveAttr(region) {
78967
79023
  const seriesRegionStartX = region.getLayoutStartPoint().x;
78968
79024
  const seriesRegionEndX = seriesRegionStartX + region.getLayoutRect().width;
78969
79025
  const seriesRegionStartY = region.getLayoutStartPoint().y;
78970
79026
  const seriesRegionEndY = seriesRegionStartY + region.getLayoutRect().height;
78971
- const brush = new Brush$1({
78972
- zIndex: this.layoutZIndex,
78973
- brushStyle: transformToGraphic(this._spec?.style),
79027
+ return {
78974
79028
  interactiveRange: {
78975
79029
  minY: seriesRegionStartY,
78976
79030
  maxY: seriesRegionEndY,
@@ -78978,46 +79032,77 @@
78978
79032
  maxX: seriesRegionEndX
78979
79033
  },
78980
79034
  xRange: [seriesRegionStartX, seriesRegionEndX],
78981
- yRange: [seriesRegionStartY, seriesRegionEndY],
78982
- ...this._spec
78983
- });
78984
- brush.id = this._spec.id ?? `brush-${this.id}`;
78985
- this.getContainer().add(brush);
78986
- const { brushMode = 'single', removeOnClick = true } = this._spec;
78987
- brush.setUpdateDragMaskCallback((operateParams) => {
78988
- const { operateType, operateMask } = operateParams;
78989
- if (this._isFristState || (brushMode === 'single' && removeOnClick && operateType === 'drawStart')) {
78990
- this._initMarkBrushState(componentIndex);
78991
- }
78992
- this._reconfigItem(operateMask, region);
78993
- this._reconfigLinkedItem(operateMask, region);
78994
- let eventType = ChartEvent.brushChange;
78995
- if (operateType === 'brushStart' || operateType === 'brushDown') {
78996
- eventType = ChartEvent.brushStart;
78997
- }
78998
- else if (operateType === 'brushEnd' || operateType === 'brushMaskUp') {
78999
- eventType = ChartEvent.brushEnd;
79000
- }
79001
- else {
79002
- eventType = ChartEvent.brushChange;
79035
+ yRange: [seriesRegionStartY, seriesRegionEndY]
79036
+ };
79037
+ }
79038
+ _createOrUpdateBrushComponent(region, componentIndex) {
79039
+ const interactiveAttr = this._getBrushInteractiveAttr(region);
79040
+ if (this._brushComponents.length === this._relativeRegions.length) {
79041
+ if (!isEqual$1(this._cacheInteractiveRangeAttrs[componentIndex], interactiveAttr)) {
79042
+ const brushComponent = this._brushComponents[componentIndex];
79043
+ brushComponent.setAttributes(interactiveAttr);
79044
+ this._initMarkBrushState(componentIndex, '');
79045
+ brushComponent.children[0].removeAllChild();
79046
+ this._needInitOutState = true;
79003
79047
  }
79004
- this.event.emit(eventType, {
79005
- model: this,
79006
- value: {
79007
- operateType,
79008
- operateRegion: region,
79009
- inBrushData: this._extendDataInBrush(this._inBrushElementsMap),
79010
- outOfBrushData: this._extendDatumOutOfBrush(this._outOfBrushElementsMap),
79011
- linkInBrushData: this._extendDataInBrush(this._linkedInBrushElementsMap),
79012
- linkOutOfBrushData: this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),
79013
- inBrushElementsMap: this._inBrushElementsMap,
79014
- outOfBrushElementsMap: this._outOfBrushElementsMap,
79015
- linkedInBrushElementsMap: this._linkedInBrushElementsMap,
79016
- linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap
79048
+ }
79049
+ else {
79050
+ const brush = new Brush$1({
79051
+ zIndex: this.layoutZIndex,
79052
+ brushStyle: transformToGraphic(this._spec?.style),
79053
+ ...interactiveAttr,
79054
+ ...this._spec
79055
+ });
79056
+ brush.id = this._spec.id ?? `brush-${this.id}`;
79057
+ this.getContainer().add(brush);
79058
+ const { brushMode = 'single' } = this._spec;
79059
+ this._brushComponents.push(brush);
79060
+ this._cacheInteractiveRangeAttrs.push(interactiveAttr);
79061
+ brush.setUpdateDragMaskCallback((operateParams) => {
79062
+ const { operateType, operateMask } = operateParams;
79063
+ if (this._isFristState ||
79064
+ (this._needInitOutState && brushMode === 'single' && operateType === IOperateType.drawing)) {
79065
+ this._initMarkBrushState(componentIndex, 'outOfBrush');
79066
+ }
79067
+ if (operateType === IOperateType.drawing) {
79068
+ this._needInitOutState = false;
79069
+ }
79070
+ if (operateType === IOperateType.drawEnd) {
79071
+ this._needInitOutState = true;
79072
+ }
79073
+ if (operateType === IOperateType.brushClear) {
79074
+ this._initMarkBrushState(componentIndex, '');
79075
+ this._needInitOutState = true;
79076
+ }
79077
+ this._reconfigItem(operateMask, region);
79078
+ this._reconfigLinkedItem(operateMask, region);
79079
+ let eventType = ChartEvent.brushChange;
79080
+ if (operateType === IOperateType.drawStart || operateType === IOperateType.moveStart) {
79081
+ eventType = ChartEvent.brushStart;
79017
79082
  }
79083
+ else if (operateType === IOperateType.drawEnd || operateType === IOperateType.moveEnd) {
79084
+ eventType = ChartEvent.brushEnd;
79085
+ }
79086
+ else {
79087
+ eventType = ChartEvent.brushChange;
79088
+ }
79089
+ this.event.emit(eventType, {
79090
+ model: this,
79091
+ value: {
79092
+ operateType,
79093
+ operateRegion: region,
79094
+ inBrushData: this._extendDataInBrush(this._inBrushElementsMap),
79095
+ outOfBrushData: this._extendDatumOutOfBrush(this._outOfBrushElementsMap),
79096
+ linkInBrushData: this._extendDataInBrush(this._linkedInBrushElementsMap),
79097
+ linkOutOfBrushData: this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),
79098
+ inBrushElementsMap: this._inBrushElementsMap,
79099
+ outOfBrushElementsMap: this._outOfBrushElementsMap,
79100
+ linkedInBrushElementsMap: this._linkedInBrushElementsMap,
79101
+ linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap
79102
+ }
79103
+ });
79018
79104
  });
79019
- });
79020
- this._brushComponents.push(brush);
79105
+ }
79021
79106
  }
79022
79107
  _transformBrushedMarkAttr(brushedStyle) {
79023
79108
  const styleResult = {};
@@ -79175,7 +79260,7 @@
79175
79260
  this._linkedItemMap[s.id] = s.getMarksWithoutRoot();
79176
79261
  });
79177
79262
  }
79178
- _initMarkBrushState(componentIndex) {
79263
+ _initMarkBrushState(componentIndex, stateName) {
79179
79264
  this._brushComponents.forEach((brush, index) => {
79180
79265
  if (index !== componentIndex) {
79181
79266
  brush.children[0].removeAllChild();
@@ -79205,7 +79290,7 @@
79205
79290
  }
79206
79291
  return;
79207
79292
  };
79208
- graphicItem.addState('outOfBrush');
79293
+ graphicItem.addState(stateName);
79209
79294
  this._outOfBrushElementsMap[el.key] = el;
79210
79295
  this._linkedOutOfBrushElementsMap[el.key] = el;
79211
79296
  });
@@ -79223,25 +79308,13 @@
79223
79308
  super.onLayoutEnd(ctx);
79224
79309
  const brushVisible = this._spec.visible ?? true;
79225
79310
  if (brushVisible) {
79226
- if (this._brushComponents.length === 0) {
79227
- this._relativeRegions.forEach((region, index) => {
79228
- this._createBrushComponent(region, index);
79229
- });
79230
- }
79311
+ this._relativeRegions.forEach((region, index) => {
79312
+ this._createOrUpdateBrushComponent(region, index);
79313
+ });
79231
79314
  }
79232
79315
  }
79233
79316
  }
79234
79317
 
79235
- var IOperateType;
79236
- (function (IOperateType) {
79237
- IOperateType["brushStart"] = "brushStart";
79238
- IOperateType["brushEnd"] = "brushEnd";
79239
- IOperateType["brushMaskUp"] = "brushMaskUp";
79240
- IOperateType["brushing"] = "brushing";
79241
- IOperateType["brushMaskDown"] = "brushMaskDown";
79242
- IOperateType["brushMaskMove"] = "brushMaskMove";
79243
- })(IOperateType || (IOperateType = {}));
79244
-
79245
79318
  function overlap$1(a, b, sep = 0) {
79246
79319
  return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
79247
79320
  }
@@ -80879,7 +80952,8 @@
80879
80952
  autoHideMethod: spec.label.autoHideMethod,
80880
80953
  autoHideSeparation: spec.label.autoHideSeparation,
80881
80954
  limitEllipsis: spec.label.limitEllipsis,
80882
- layoutFunc: spec.label.layoutFunc
80955
+ layoutFunc: spec.label.layoutFunc,
80956
+ dataFilter: spec.label.dataFilter
80883
80957
  },
80884
80958
  tick: {
80885
80959
  visible: spec.tick.visible,
@@ -80892,7 +80966,8 @@
80892
80966
  return transformToGraphic(this._preprocessSpec(merge$2({}, this._theme.tick?.style, style)));
80893
80967
  }
80894
80968
  : transformToGraphic(spec.tick.style),
80895
- state: transformStateStyle(spec.tick.state)
80969
+ state: transformStateStyle(spec.tick.state),
80970
+ dataFilter: spec.tick.dataFilter
80896
80971
  },
80897
80972
  subTick: {
80898
80973
  visible: spec.subTick.visible,
@@ -82151,8 +82226,11 @@
82151
82226
  this._tick = this._spec.tick;
82152
82227
  this._orient = this._spec.orient === 'angle' ? 'angle' : 'radius';
82153
82228
  this._center = this._spec.center;
82154
- this._startAngle = radians(this._spec.startAngle ?? POLAR_START_ANGLE$1);
82155
- this._endAngle = radians(this._spec.endAngle ?? (isValid(this._spec.startAngle) ? this._spec.startAngle + 360 : POLAR_END_ANGLE$1));
82229
+ const chartSpec = this.getChart().getSpec();
82230
+ const startAngle = this._spec.startAngle ?? chartSpec.startAngle;
82231
+ const endAngle = this._spec.endAngle ?? chartSpec.endAngle;
82232
+ this._startAngle = radians(startAngle ?? POLAR_START_ANGLE$1);
82233
+ this._endAngle = radians(endAngle ?? (isValid(startAngle) ? startAngle + 360 : POLAR_END_ANGLE$1));
82156
82234
  }
82157
82235
  setLayoutStartPosition(pos) {
82158
82236
  const region = this.getRegions()?.[0];