@visactor/vchart 2.0.0-alpha.4 → 2.0.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 (84) hide show
  1. package/build/es5/index.js +2 -2
  2. package/build/index.es.js +230 -123
  3. package/build/index.js +230 -123
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/interface.d.ts +1 -0
  7. package/cjs/animation/interface.js.map +1 -1
  8. package/cjs/chart/histogram/base/histogram-base-transformer.js +1 -1
  9. package/cjs/chart/histogram/base/histogram-base-transformer.js.map +1 -1
  10. package/cjs/component/brush/brush.d.ts +1 -1
  11. package/cjs/component/brush/brush.js +18 -14
  12. package/cjs/component/brush/brush.js.map +1 -1
  13. package/cjs/component/crosshair/base.js +4 -3
  14. package/cjs/component/crosshair/base.js.map +1 -1
  15. package/cjs/component/crosshair/cartesian.js +3 -2
  16. package/cjs/component/crosshair/cartesian.js.map +1 -1
  17. package/cjs/component/crosshair/interface/common.d.ts +3 -1
  18. package/cjs/component/crosshair/interface/common.js.map +1 -1
  19. package/cjs/component/crosshair/interface/spec.d.ts +1 -0
  20. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  21. package/cjs/component/crosshair/interface/theme.d.ts +2 -0
  22. package/cjs/component/crosshair/interface/theme.js.map +1 -1
  23. package/cjs/component/crosshair/utils/cartesian.js +15 -13
  24. package/cjs/component/crosshair/utils/cartesian.js.map +1 -1
  25. package/cjs/component/crosshair/utils/common.js +8 -4
  26. package/cjs/component/crosshair/utils/common.js.map +1 -1
  27. package/cjs/component/marker/utils.js +14 -9
  28. package/cjs/component/marker/utils.js.map +1 -1
  29. package/cjs/component/tooltip/interface/theme.d.ts +3 -0
  30. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  31. package/cjs/component/tooltip/tooltip-transformer.js +3 -1
  32. package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
  33. package/cjs/core/index.d.ts +1 -1
  34. package/cjs/core/index.js +1 -1
  35. package/cjs/core/index.js.map +1 -1
  36. package/cjs/mark/base/base-mark.js +16 -12
  37. package/cjs/mark/base/base-mark.js.map +1 -1
  38. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +2 -3
  39. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  40. package/cjs/series/bar/bar.d.ts +3 -0
  41. package/cjs/series/bar/bar.js +28 -7
  42. package/cjs/series/bar/bar.js.map +1 -1
  43. package/cjs/series/bar/interface.d.ts +1 -0
  44. package/cjs/series/bar/interface.js.map +1 -1
  45. package/esm/animation/interface.d.ts +1 -0
  46. package/esm/animation/interface.js.map +1 -1
  47. package/esm/chart/histogram/base/histogram-base-transformer.js +1 -1
  48. package/esm/chart/histogram/base/histogram-base-transformer.js.map +1 -1
  49. package/esm/component/brush/brush.d.ts +1 -1
  50. package/esm/component/brush/brush.js +18 -14
  51. package/esm/component/brush/brush.js.map +1 -1
  52. package/esm/component/crosshair/base.js +4 -3
  53. package/esm/component/crosshair/base.js.map +1 -1
  54. package/esm/component/crosshair/cartesian.js +3 -2
  55. package/esm/component/crosshair/cartesian.js.map +1 -1
  56. package/esm/component/crosshair/interface/common.d.ts +3 -1
  57. package/esm/component/crosshair/interface/common.js.map +1 -1
  58. package/esm/component/crosshair/interface/spec.d.ts +1 -0
  59. package/esm/component/crosshair/interface/spec.js.map +1 -1
  60. package/esm/component/crosshair/interface/theme.d.ts +2 -0
  61. package/esm/component/crosshair/interface/theme.js.map +1 -1
  62. package/esm/component/crosshair/utils/cartesian.js +15 -13
  63. package/esm/component/crosshair/utils/cartesian.js.map +1 -1
  64. package/esm/component/crosshair/utils/common.js +8 -4
  65. package/esm/component/crosshair/utils/common.js.map +1 -1
  66. package/esm/component/marker/utils.js +15 -8
  67. package/esm/component/marker/utils.js.map +1 -1
  68. package/esm/component/tooltip/interface/theme.d.ts +3 -0
  69. package/esm/component/tooltip/interface/theme.js.map +1 -1
  70. package/esm/component/tooltip/tooltip-transformer.js +3 -1
  71. package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
  72. package/esm/core/index.d.ts +1 -1
  73. package/esm/core/index.js +1 -1
  74. package/esm/core/index.js.map +1 -1
  75. package/esm/mark/base/base-mark.js +16 -12
  76. package/esm/mark/base/base-mark.js.map +1 -1
  77. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +2 -3
  78. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  79. package/esm/series/bar/bar.d.ts +3 -0
  80. package/esm/series/bar/bar.js +26 -7
  81. package/esm/series/bar/bar.js.map +1 -1
  82. package/esm/series/bar/interface.d.ts +1 -0
  83. package/esm/series/bar/interface.js.map +1 -1
  84. package/package.json +6 -6
package/build/index.js CHANGED
@@ -23552,6 +23552,18 @@
23552
23552
  const changeEvent = new CustomEvent(eventName, details);
23553
23553
  changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager, this.dispatchEvent(changeEvent);
23554
23554
  }
23555
+ eventPosToStagePos(e) {
23556
+ var _a, _b;
23557
+ const result = {
23558
+ x: 0,
23559
+ y: 0
23560
+ },
23561
+ stagePoints = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventPointTransform(e)) && void 0 !== _b ? _b : {
23562
+ x: 0,
23563
+ y: 0
23564
+ };
23565
+ return this.globalTransMatrix.transformPoint(stagePoints, result), result;
23566
+ }
23555
23567
  }
23556
23568
 
23557
23569
  const MathPickerContribution = Symbol.for("MathPickerContribution");
@@ -31542,6 +31554,10 @@
31542
31554
  target.attribute.x = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
31543
31555
  }, this.y = (key, from, to, ratio, step, target) => {
31544
31556
  target.attribute.y = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
31557
+ }, this.dx = (key, from, to, ratio, step, target) => {
31558
+ target.attribute.dx = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
31559
+ }, this.dy = (key, from, to, ratio, step, target) => {
31560
+ target.attribute.dy = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
31545
31561
  }, this.angle = (key, from, to, ratio, step, target) => {
31546
31562
  target.attribute.angle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
31547
31563
  }, this.scaleX = (key, from, to, ratio, step, target) => {
@@ -32402,7 +32418,10 @@
32402
32418
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
32403
32419
  var _a, _b, _c, _d;
32404
32420
  if (custom && customType) {
32405
- const customParams = this.resolveValue(customParameters, graphic, {}),
32421
+ const customParams = this.resolveValue(customParameters, graphic, {
32422
+ width: graphic.stage.width,
32423
+ height: graphic.stage.height
32424
+ }),
32406
32425
  objOptions = isFunction$1(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
32407
32426
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
32408
32427
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
@@ -35965,11 +35984,11 @@
35965
35984
  }
35966
35985
  onBind() {
35967
35986
  var _a, _b;
35968
- super.onBind();
35987
+ super.onBind(), Object.keys(this.from).forEach(key => {
35988
+ null == this.props[key] && (this.props[key] = this.target.getGraphicAttribute(key));
35989
+ });
35969
35990
  const finalAttribute = this.target.getFinalAttribute();
35970
- Object.keys(this.from).forEach(key => {
35971
- null == this.props[key] && (this.props[key] = finalAttribute[key]);
35972
- }), "appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) && finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_b = this.params.controlOptions) || void 0 === _b ? void 0 : _b.immediatelyApply) && this.target.setAttributes(this.from);
35991
+ "appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) && finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_b = this.params.controlOptions) || void 0 === _b ? void 0 : _b.immediatelyApply) && this.target.setAttributes(this.from);
35973
35992
  }
35974
35993
  onFirstRun() {
35975
35994
  this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
@@ -36975,7 +36994,7 @@
36975
36994
  const MIN_TICK_GAP = 12;
36976
36995
  const calculateFlushPos = (basePosition, size, rangePosition, otherEnd) => rangePosition < basePosition ? Math.max(basePosition - size / 2, rangePosition) : rangePosition > basePosition ? Math.min(basePosition - size / 2, rangePosition - size) : rangePosition < otherEnd ? rangePosition : rangePosition - size;
36977
36996
  const getCartesianLabelBounds = (scale, domain, op) => {
36978
- var _a;
36997
+ var _a, _b, _c;
36979
36998
  const {
36980
36999
  labelStyle: labelStyle,
36981
37000
  axisOrientType: axisOrientType,
@@ -36991,27 +37010,32 @@
36991
37010
  scaleY = 0;
36992
37011
  isHorizontal || (isVertical ? (scaleX = 0, scaleY = 1) : startAngle && (scaleX = Math.cos(startAngle), scaleY = -Math.sin(startAngle)));
36993
37012
  const textMeasure = initTextMeasure$1(labelStyle),
36994
- range = scale.range(),
36995
- labelBoundsList = domain.map((v, i) => {
36996
- var _a, _b;
36997
- const str = labelFormatter ? labelFormatter(v) : `${v}`,
36998
- {
36999
- width: width,
37000
- height: height
37001
- } = textMeasure.quickMeasure(str),
37002
- textWidth = Math.max(width, 12),
37003
- textHeight = Math.max(height, 12),
37004
- pos = scale.scale(v),
37005
- baseTextX = scaleX * pos,
37006
- baseTextY = scaleY * pos;
37007
- let align,
37008
- baseline,
37009
- textX = baseTextX,
37010
- textY = baseTextY;
37011
- labelFlush && isHorizontal && 0 === i ? textX = calculateFlushPos(baseTextX, textWidth, range[0], range[range.length - 1]) : labelFlush && isHorizontal && i === domain.length - 1 ? textX = calculateFlushPos(baseTextX, textWidth, range[range.length - 1], range[0]) : align = null !== (_a = labelStyle.textAlign) && void 0 !== _a ? _a : "center", "right" === align ? textX -= textWidth : "center" === align && (textX -= textWidth / 2), labelFlush && isVertical && 0 === i ? textY = calculateFlushPos(baseTextY, textHeight, range[0], range[range.length - 1]) : labelFlush && isVertical && i === domain.length - 1 ? textY = calculateFlushPos(baseTextY, textHeight, range[range.length - 1], range[0]) : baseline = null !== (_b = labelStyle.textBaseline) && void 0 !== _b ? _b : "middle", "bottom" === baseline ? textY -= textHeight : "middle" === baseline && (textY -= textHeight / 2);
37012
- const bounds = new AABBBounds().set(textX, textY, textX + textWidth, textY + textHeight);
37013
- return labelAngle && bounds.rotate(labelAngle, baseTextX, baseTextY), bounds;
37014
- });
37013
+ range = scale.range();
37014
+ let labelBoundsList = [];
37015
+ for (let i = 0; i < domain.length; i++) {
37016
+ const v = domain[i],
37017
+ str = labelFormatter ? labelFormatter(v) : `${v}`;
37018
+ if (isPlainObject$1(str)) {
37019
+ labelBoundsList = void 0;
37020
+ break;
37021
+ }
37022
+ const {
37023
+ width: width,
37024
+ height: height
37025
+ } = textMeasure.quickMeasure(str),
37026
+ textWidth = Math.max(width, 12),
37027
+ textHeight = Math.max(height, 12),
37028
+ pos = scale.scale(v),
37029
+ baseTextX = scaleX * pos,
37030
+ baseTextY = scaleY * pos;
37031
+ let align,
37032
+ baseline,
37033
+ textX = baseTextX,
37034
+ textY = baseTextY;
37035
+ labelFlush && isHorizontal && 0 === i ? textX = calculateFlushPos(baseTextX, textWidth, range[0], range[range.length - 1]) : labelFlush && isHorizontal && i === domain.length - 1 ? textX = calculateFlushPos(baseTextX, textWidth, range[range.length - 1], range[0]) : align = null !== (_b = labelStyle.textAlign) && void 0 !== _b ? _b : "center", "right" === align ? textX -= textWidth : "center" === align && (textX -= textWidth / 2), labelFlush && isVertical && 0 === i ? textY = calculateFlushPos(baseTextY, textHeight, range[0], range[range.length - 1]) : labelFlush && isVertical && i === domain.length - 1 ? textY = calculateFlushPos(baseTextY, textHeight, range[range.length - 1], range[0]) : baseline = null !== (_c = labelStyle.textBaseline) && void 0 !== _c ? _c : "middle", "bottom" === baseline ? textY -= textHeight : "middle" === baseline && (textY -= textHeight / 2);
37036
+ const bounds = new AABBBounds().set(textX, textY, textX + textWidth, textY + textHeight);
37037
+ labelAngle && bounds.rotate(labelAngle, baseTextX, baseTextY), labelBoundsList.push(bounds);
37038
+ }
37015
37039
  return labelBoundsList;
37016
37040
  };
37017
37041
  const isAxisHorizontal = axisOrientType => ["bottom", "top", "z"].includes(axisOrientType);
@@ -38031,7 +38055,7 @@
38031
38055
  }
38032
38056
  }
38033
38057
  const continuousTicks = (scale, op) => {
38034
- var _a, _b;
38058
+ var _a, _b, _c, _d;
38035
38059
  if (!isContinuous(scale.type)) return convertDomainToTickData(scale.domain());
38036
38060
  const range = scale.range(),
38037
38061
  rangeSize = Math.abs(range[range.length - 1] - range[0]);
@@ -38083,23 +38107,25 @@
38083
38107
  step = Math.floor(scaleTicks.length * MIN_FONT_SIZE / rangeSize);
38084
38108
  scaleTicks.forEach((tick, index) => {
38085
38109
  index % step != 0 && index !== scaleTicks.length - 1 || samplingScaleTicks.push(tick);
38086
- }), items = getCartesianLabelBounds(scale, samplingScaleTicks, op).map((bounds, i) => ({
38110
+ }), items = null === (_c = getCartesianLabelBounds(scale, samplingScaleTicks, op)) || void 0 === _c ? void 0 : _c.map((bounds, i) => ({
38087
38111
  AABBBounds: bounds,
38088
38112
  value: samplingScaleTicks[i]
38089
38113
  }));
38090
- } else items = getCartesianLabelBounds(scale, scaleTicks, op).map((bounds, i) => ({
38114
+ } else items = null === (_d = getCartesianLabelBounds(scale, scaleTicks, op)) || void 0 === _d ? void 0 : _d.map((bounds, i) => ({
38091
38115
  AABBBounds: bounds,
38092
38116
  value: scaleTicks[i]
38093
38117
  }));
38094
- const firstSourceItem = items[0],
38095
- lastSourceItem = last(items),
38096
- samplingMethod = breakData && breakData() ? methods$1.greedy : methods$1.parity;
38097
- for (; items.length >= 3 && hasOverlap$1(items, labelGap);) items = samplingMethod(items, labelGap);
38098
- const checkFirst = op.labelFirstVisible;
38099
- let checkLast = op.labelLastVisible;
38100
- textIntersect(firstSourceItem, lastSourceItem, labelGap) && items.includes(lastSourceItem) && items.length > 1 && checkFirst && checkLast && (items.splice(items.indexOf(lastSourceItem), 1), checkLast = !1), forceItemVisible(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, labelGap)), forceItemVisible(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, labelGap) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, labelGap), !0);
38101
- const ticks = items.map(item => item.value);
38102
- ticks.length < 3 && labelFlush && (ticks.length > 1 && ticks.pop(), last(ticks) !== last(scaleTicks) && ticks.push(last(scaleTicks))), scaleTicks = ticks;
38118
+ if (items) {
38119
+ const firstSourceItem = items[0],
38120
+ lastSourceItem = last(items),
38121
+ samplingMethod = breakData && breakData() ? methods$1.greedy : methods$1.parity;
38122
+ for (; items.length >= 3 && hasOverlap$1(items, labelGap);) items = samplingMethod(items, labelGap);
38123
+ const checkFirst = op.labelFirstVisible;
38124
+ let checkLast = op.labelLastVisible;
38125
+ textIntersect(firstSourceItem, lastSourceItem, labelGap) && items.includes(lastSourceItem) && items.length > 1 && checkFirst && checkLast && (items.splice(items.indexOf(lastSourceItem), 1), checkLast = !1), forceItemVisible(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, labelGap)), forceItemVisible(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, labelGap) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, labelGap), !0);
38126
+ const ticks = items.map(item => item.value);
38127
+ ticks.length < 3 && labelFlush && (ticks.length > 1 && ticks.pop(), last(ticks) !== last(scaleTicks) && ticks.push(last(scaleTicks))), scaleTicks = ticks;
38128
+ }
38103
38129
  }
38104
38130
  return convertDomainToTickData(scaleTicks);
38105
38131
  };
@@ -38113,7 +38139,10 @@
38113
38139
  }
38114
38140
  };
38115
38141
 
38116
- const getOneDimensionalLabelBounds = (scale, domain, op, isHorizontal) => getCartesianLabelBounds(scale, domain, op).map(bounds => isHorizontal ? [bounds.x1, bounds.x2, bounds.width()] : [bounds.y1, bounds.y2, bounds.height()]),
38142
+ const getOneDimensionalLabelBounds = (scale, domain, op, isHorizontal) => {
38143
+ const labelBoundsList = getCartesianLabelBounds(scale, domain, op);
38144
+ return labelBoundsList && labelBoundsList.map(bounds => isHorizontal ? [bounds.x1, bounds.x2, bounds.width()] : [bounds.y1, bounds.y2, bounds.height()]);
38145
+ },
38117
38146
  boundsOverlap = (prevBounds, nextBounds, gap = 0) => Math.max(prevBounds[0], nextBounds[0]) - gap / 2 <= Math.min(prevBounds[1], nextBounds[1]) + gap / 2;
38118
38147
  const boundsDistance = (prevBounds, nextBounds) => prevBounds[1] < nextBounds[0] ? nextBounds[0] - prevBounds[1] : nextBounds[1] < prevBounds[0] ? prevBounds[0] - nextBounds[1] : 0;
38119
38148
  const linearDiscreteTicks = (scale, op) => {
@@ -38144,23 +38173,27 @@
38144
38173
  rangeStart = minInArray(range),
38145
38174
  rangeEnd = maxInArray(range);
38146
38175
  if (domain.length <= rangeSize / fontSize) {
38147
- const incrementUnit = (rangeEnd - rangeStart) / domain.length,
38148
- labelBoundsList = getOneDimensionalLabelBounds(scale, domain, op, isHorizontal),
38149
- minBoundsLength = Math.min(...labelBoundsList.map(bounds => bounds[2])),
38150
- stepResult = getStep$1(domain, labelBoundsList, labelGap, op.labelLastVisible, Math.floor(minBoundsLength / incrementUnit), !1);
38151
- scaleTicks = scale.stepTicks(stepResult.step), op.labelLastVisible && (stepResult.delCount && (scaleTicks = scaleTicks.slice(0, scaleTicks.length - stepResult.delCount)), scaleTicks.push(domain[domain.length - 1]));
38176
+ const labelBoundsList = getOneDimensionalLabelBounds(scale, domain, op, isHorizontal);
38177
+ if (labelBoundsList) {
38178
+ const minBoundsLength = Math.min(...labelBoundsList.map(bounds => bounds[2])),
38179
+ incrementUnit = (rangeEnd - rangeStart) / domain.length,
38180
+ stepResult = getStep$1(domain, labelBoundsList, labelGap, op.labelLastVisible, Math.floor(minBoundsLength / incrementUnit), !1);
38181
+ scaleTicks = scale.stepTicks(stepResult.step), op.labelLastVisible && (stepResult.delCount && (scaleTicks = scaleTicks.slice(0, scaleTicks.length - stepResult.delCount)), scaleTicks.push(domain[domain.length - 1]));
38182
+ }
38152
38183
  } else {
38153
38184
  const tempDomain = [domain[0], domain[Math.floor(domain.length / 2)], domain[domain.length - 1]],
38154
38185
  tempList = getOneDimensionalLabelBounds(scale, tempDomain, op, isHorizontal);
38155
- let maxBounds = null;
38156
- tempList.forEach(current => {
38157
- maxBounds ? maxBounds[2] < current[2] && (maxBounds = current) : maxBounds = current;
38158
- });
38159
- const step = rangeEnd - rangeStart - labelGap > 0 ? Math.ceil(domain.length * (labelGap + maxBounds[2]) / (rangeEnd - rangeStart - labelGap)) : domain.length - 1;
38160
- scaleTicks = scale.stepTicks(step), !op.labelLastVisible || scaleTicks.length && scaleTicks[scaleTicks.length - 1] === domain[domain.length - 1] || (scaleTicks.length && Math.abs(scale.scale(scaleTicks[scaleTicks.length - 1]) - scale.scale(domain[domain.length - 1])) < maxBounds[2] && (scaleTicks = scaleTicks.slice(0, -1)), scaleTicks.push(domain[domain.length - 1]));
38186
+ if (tempList) {
38187
+ let maxBounds = null;
38188
+ tempList.forEach(current => {
38189
+ maxBounds ? maxBounds[2] < current[2] && (maxBounds = current) : maxBounds = current;
38190
+ });
38191
+ const step = rangeEnd - rangeStart - labelGap > 0 ? Math.ceil(domain.length * (labelGap + maxBounds[2]) / (rangeEnd - rangeStart - labelGap)) : domain.length - 1;
38192
+ scaleTicks = scale.stepTicks(step), !op.labelLastVisible || scaleTicks.length && scaleTicks[scaleTicks.length - 1] === domain[domain.length - 1] || (scaleTicks.length && Math.abs(scale.scale(scaleTicks[scaleTicks.length - 1]) - scale.scale(domain[domain.length - 1])) < maxBounds[2] && (scaleTicks = scaleTicks.slice(0, -1)), scaleTicks.push(domain[domain.length - 1]));
38193
+ }
38161
38194
  }
38162
- } else scaleTicks = scale.domain();
38163
- return convertDomainToTickData(scaleTicks);
38195
+ }
38196
+ return isNil$1(scaleTicks) && (scaleTicks = scale.domain()), convertDomainToTickData(scaleTicks);
38164
38197
  };
38165
38198
  const getStep$1 = (domain, labelBoundsList, labelGap, labelLastVisible, defaultStep, areAllBoundsSame) => {
38166
38199
  let resultDelCount = 0,
@@ -41056,13 +41089,6 @@
41056
41089
  end: end
41057
41090
  }));
41058
41091
  }
41059
- eventPosToStagePos(e) {
41060
- var _a, _b;
41061
- return null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventPointTransform(e)) && void 0 !== _b ? _b : {
41062
- x: 0,
41063
- y: 0
41064
- };
41065
- }
41066
41092
  _clearDragEvents() {
41067
41093
  const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
41068
41094
  triggers = getEndTriggersOfDrag();
@@ -41221,7 +41247,13 @@
41221
41247
  } = this.attribute.startTextStyle;
41222
41248
  if (new Bounds().set(x1, y1, x2, y2).intersects(endTextBounds)) {
41223
41249
  const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
41224
- this._isHorizontal ? this._startText.setAttribute("dy", startTextDy + direction * Math.abs(endTextBounds.y1 - endTextBounds.y2)) : this._startText.setAttribute("dx", startTextDx + direction * Math.abs(endTextBounds.x1 - endTextBounds.x2));
41250
+ if (this._isHorizontal) {
41251
+ const boundsYDiff = Math.abs(endTextBounds.y1 - endTextBounds.y2);
41252
+ this._startText.setAttribute("dy", startTextDy + direction * (Number.isFinite(boundsYDiff) ? boundsYDiff : 0));
41253
+ } else {
41254
+ const boundsXDiff = Math.abs(endTextBounds.x1 - endTextBounds.x2);
41255
+ this._startText.setAttribute("dx", startTextDx + direction * (Number.isFinite(boundsXDiff) ? boundsXDiff : 0));
41256
+ }
41225
41257
  } else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
41226
41258
  }
41227
41259
  getLayoutAttrFromConfig() {
@@ -46371,8 +46403,7 @@
46371
46403
  loadBrushComponent();
46372
46404
  let Brush$1 = class Brush extends AbstractComponent {
46373
46405
  constructor(attributes, options) {
46374
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, 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._firstUpdate = !0, this._onBrushStart = e => {
46375
- if (this._outOfInteractiveRange(e)) return void (this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)));
46406
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, 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._firstUpdate = !0, this._onBrushStart = e => {
46376
46407
  const {
46377
46408
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
46378
46409
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -46400,7 +46431,7 @@
46400
46431
  brushMode: brushMode
46401
46432
  } = this.attribute,
46402
46433
  pos = this.eventPosToStagePos(e);
46403
- this._cacheDrawPoints.push(pos), "single" === brushMode && this._clearMask(), this._addBrushMask(), this._dispatchBrushEvent(IOperateType.drawStart, e), 1 === Object.keys(this._brushMaskAABBBoundsDict).length && this._dispatchBrushEvent(IOperateType.brushActive, e);
46434
+ this._cacheDrawPoints.push(pos), "single" === brushMode && this._clearMask(), this._addBrushMask(), this._dispatchBrushEvent(IOperateType.drawStart, e), this._activeBrushState = !1;
46404
46435
  }
46405
46436
  _initMove(e) {
46406
46437
  var _a, _b;
@@ -46430,7 +46461,8 @@
46430
46461
  var _a;
46431
46462
  const pos = this.eventPosToStagePos(e),
46432
46463
  {
46433
- brushType: brushType
46464
+ brushType: brushType,
46465
+ sizeThreshold = DEFAULT_SIZE_THRESHOLD
46434
46466
  } = this.attribute,
46435
46467
  cacheLength = this._cacheDrawPoints.length;
46436
46468
  if (cacheLength > 0) {
@@ -46439,7 +46471,16 @@
46439
46471
  }
46440
46472
  "polygon" === brushType || cacheLength <= 1 ? this._cacheDrawPoints.push(pos) : this._cacheDrawPoints[cacheLength - 1] = pos;
46441
46473
  const maskPoints = this._computeMaskPoints();
46442
- this._operatingMask.setAttribute("points", maskPoints), this._dispatchBrushEvent(IOperateType.drawing, e);
46474
+ this._operatingMask.setAttribute("points", maskPoints);
46475
+ const {
46476
+ x: x1,
46477
+ y: y1
46478
+ } = this._startPos,
46479
+ {
46480
+ x: x2,
46481
+ y: y2
46482
+ } = this.eventPosToStagePos(e);
46483
+ (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) && (1 !== Object.keys(this._brushMaskAABBBoundsDict).length || this._activeBrushState ? this._dispatchBrushEvent(IOperateType.drawing, e) : (this._activeBrushState = !0, this._dispatchBrushEvent(IOperateType.brushActive, e)));
46443
46484
  }
46444
46485
  _moving(e) {
46445
46486
  const startPos = this._cacheMovePoint,
@@ -46579,9 +46620,6 @@
46579
46620
  pos = this.eventPosToStagePos(e);
46580
46621
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
46581
46622
  }
46582
- eventPosToStagePos(e) {
46583
- return this.stage.eventPointTransform(e);
46584
- }
46585
46623
  _dispatchBrushEvent(operateType, e) {
46586
46624
  this._dispatchEvent(operateType, {
46587
46625
  operateMask: this._operatingMask,
@@ -46590,7 +46628,7 @@
46590
46628
  });
46591
46629
  }
46592
46630
  _clearMask() {
46593
- this._brushMaskAABBBoundsDict = {}, this._container.incrementalClearChild(), this._operatingMask = null;
46631
+ this._brushMaskAABBBoundsDict = {}, this._container.removeAllChild(), this._operatingMask = null;
46594
46632
  }
46595
46633
  _isEmptyMask() {
46596
46634
  return isEmpty(this._brushMaskAABBBoundsDict) || Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty());
@@ -53169,20 +53207,24 @@
53169
53207
  return this._animationConfig;
53170
53208
  }
53171
53209
  setAnimationConfig(config) {
53172
- const animationConfig = Object.assign({}, config);
53173
- Object.keys(animationConfig).forEach(key => {
53174
- const value = animationConfig[key];
53210
+ const defaultPrams = this.type === 'group' ? { selfOnly: true } : {};
53211
+ const animationConfig = {};
53212
+ Object.keys(config).forEach(key => {
53213
+ const value = config[key];
53175
53214
  if (isArray$1(value)) {
53176
- value.forEach(item => {
53215
+ animationConfig[key] = value.map(item => {
53177
53216
  var _a;
53178
53217
  const options = (_a = item.options) !== null && _a !== void 0 ? _a : {};
53179
- item.options = (...args) => {
53180
- var _a, _b;
53181
- const _options = typeof options === 'function' ? options(...args) : options;
53182
- return Object.assign(Object.assign({}, _options), { layoutRect: (_b = (_a = this.model).getLayoutRect) === null || _b === void 0 ? void 0 : _b.call(_a) });
53183
- };
53218
+ return Object.assign(Object.assign(Object.assign({}, defaultPrams), item), { options: (...args) => {
53219
+ var _a, _b;
53220
+ const _options = typeof options === 'function' ? options(...args) : options;
53221
+ return Object.assign(Object.assign({}, _options), { layoutRect: (_b = (_a = this.model).getLayoutRect) === null || _b === void 0 ? void 0 : _b.call(_a) });
53222
+ } });
53184
53223
  });
53185
53224
  }
53225
+ else {
53226
+ animationConfig[key] = Object.assign(Object.assign({}, defaultPrams), config[key]);
53227
+ }
53186
53228
  });
53187
53229
  this._animationConfig = animationConfig;
53188
53230
  }
@@ -56730,7 +56772,7 @@
56730
56772
  });
56731
56773
  };
56732
56774
 
56733
- const version = "2.0.0-alpha.4";
56775
+ const version = "2.0.0";
56734
56776
 
56735
56777
  const addVChartProperty = (data, op) => {
56736
56778
  const context = op.beforeCall();
@@ -60675,7 +60717,7 @@
60675
60717
  const getCartesianCrosshairTheme = (getTheme, chartSpec) => {
60676
60718
  var _a, _b;
60677
60719
  const axes = array((_a = chartSpec.axes) !== null && _a !== void 0 ? _a : []);
60678
- const { bandField, linearField, xField, yField } = (_b = getComponentThemeFromOption(ComponentTypeEnum.crosshair, getTheme)) !== null && _b !== void 0 ? _b : {};
60720
+ const { bandField, linearField, xField, yField, trigger, triggerOff } = (_b = getComponentThemeFromOption(ComponentTypeEnum.crosshair, getTheme)) !== null && _b !== void 0 ? _b : {};
60679
60721
  const xAxis = axes.find(axis => isXAxis(axis.orient));
60680
60722
  let newXField;
60681
60723
  if (isValid$1(xAxis)) {
@@ -60694,13 +60736,15 @@
60694
60736
  }
60695
60737
  return {
60696
60738
  xField: newXField,
60697
- yField: newYField
60739
+ yField: newYField,
60740
+ trigger,
60741
+ triggerOff
60698
60742
  };
60699
60743
  };
60700
60744
  const getPolarCrosshairTheme = (getTheme, chartSpec) => {
60701
60745
  var _a, _b;
60702
60746
  const axes = array((_a = chartSpec.axes) !== null && _a !== void 0 ? _a : []);
60703
- const { bandField, linearField, categoryField, valueField } = (_b = getComponentThemeFromOption(ComponentTypeEnum.crosshair, getTheme)) !== null && _b !== void 0 ? _b : {};
60747
+ const { bandField, linearField, categoryField, valueField, trigger, triggerOff } = (_b = getComponentThemeFromOption(ComponentTypeEnum.crosshair, getTheme)) !== null && _b !== void 0 ? _b : {};
60704
60748
  const angleAxis = axes.find(axis => axis.orient === 'angle');
60705
60749
  let newAngleField;
60706
60750
  if (isValid$1(angleAxis)) {
@@ -60719,7 +60763,9 @@
60719
60763
  }
60720
60764
  return {
60721
60765
  categoryField: newAngleField,
60722
- valueField: newRadiusField
60766
+ valueField: newRadiusField,
60767
+ trigger,
60768
+ triggerOff
60723
60769
  };
60724
60770
  };
60725
60771
 
@@ -66235,9 +66281,11 @@
66235
66281
  layoutStartPoint = { x: 0, y: 0 };
66236
66282
  }
66237
66283
  Object.keys(stateByField).forEach(field => {
66284
+ var _a, _b, _c, _d, _e;
66238
66285
  const { currentValue, cacheInfo, labelsComp, attributes, coordKey } = stateByField[field];
66239
66286
  let axis = null;
66240
66287
  let coord = 0;
66288
+ let axisLabel = null;
66241
66289
  if (currentValue.size) {
66242
66290
  const item = Array.from(currentValue.values())[0];
66243
66291
  coord =
@@ -66245,6 +66293,8 @@
66245
66293
  item.axis.getLayoutStartPoint()[coordKey] -
66246
66294
  layoutStartPoint[coordKey];
66247
66295
  axis = item.axis;
66296
+ axisLabel = (_e = (_d = (_c = (_b = (_a = axis
66297
+ .getVRenderComponents()[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.getChildByName('axis-label-container')) === null || _d === void 0 ? void 0 : _d.getChildByName('axis-label-container-layer-0')) === null || _e === void 0 ? void 0 : _e.children[0];
66248
66298
  }
66249
66299
  const isVisible = !!currentValue.size && Number.isFinite(coord) && !Number.isNaN(coord);
66250
66300
  const useCache = enableRemain && !isVisible && isValid$1(cacheInfo);
@@ -66262,7 +66312,8 @@
66262
66312
  }, {})
66263
66313
  : null,
66264
66314
  visible: isVisible,
66265
- axis
66315
+ axis,
66316
+ axisLabel: axisLabel
66266
66317
  };
66267
66318
  if (newCacheInfo) {
66268
66319
  newCacheInfo._isCache = useCache;
@@ -66271,7 +66322,7 @@
66271
66322
  let offsetSize = 0;
66272
66323
  if (attributes) {
66273
66324
  currentValue.forEach(({ axis, datum: value = '' }) => {
66274
- var _a;
66325
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
66275
66326
  let niceLabelFormatter = null;
66276
66327
  const scale = axis.getScale();
66277
66328
  if (isDiscrete(scale.type)) {
@@ -66300,36 +66351,37 @@
66300
66351
  if (newCacheInfo && ((_a = attributes.label) === null || _a === void 0 ? void 0 : _a.visible) && !useCache) {
66301
66352
  const labelOffset = getAxisLabelOffset(axis.getSpec());
66302
66353
  const axisOrient = axis.getOrient();
66354
+ const syncAxisLabelAngle = (_b = attributes.label) === null || _b === void 0 ? void 0 : _b.syncAxisLabelAngle;
66303
66355
  if (newCacheInfo.labels[axisOrient]) {
66304
66356
  newCacheInfo.labels[axisOrient].visible = true;
66305
66357
  newCacheInfo.labels[axisOrient].text = value;
66306
66358
  if (axisOrient === 'left') {
66307
66359
  newCacheInfo.labels[axisOrient].dx = -labelOffset;
66308
66360
  newCacheInfo.labelsTextStyle[axisOrient] = {
66309
- textAlign: 'right',
66310
- textBaseline: 'middle'
66361
+ textAlign: syncAxisLabelAngle && axisLabel ? (_c = axisLabel.attribute.textAlign) !== null && _c !== void 0 ? _c : 'right' : 'right',
66362
+ textBaseline: syncAxisLabelAngle && axisLabel ? (_d = axisLabel.attribute.textBaseline) !== null && _d !== void 0 ? _d : 'middle' : 'middle'
66311
66363
  };
66312
66364
  }
66313
66365
  else if (axisOrient === 'right') {
66314
66366
  newCacheInfo.labels[axisOrient].dx = labelOffset;
66315
66367
  newCacheInfo.labelsTextStyle[axisOrient] = {
66316
- textAlign: 'left',
66317
- textBaseline: 'middle'
66368
+ textAlign: syncAxisLabelAngle && axisLabel ? (_e = axisLabel.attribute.textAlign) !== null && _e !== void 0 ? _e : 'left' : 'left',
66369
+ textBaseline: syncAxisLabelAngle && axisLabel ? (_f = axisLabel.attribute.textBaseline) !== null && _f !== void 0 ? _f : 'middle' : 'middle'
66318
66370
  };
66319
66371
  }
66320
66372
  else if (axisOrient === 'top') {
66321
66373
  newCacheInfo.labels[axisOrient].y = 0;
66322
66374
  newCacheInfo.labels[axisOrient].dy = -labelOffset;
66323
66375
  newCacheInfo.labelsTextStyle[axisOrient] = {
66324
- textAlign: 'center',
66325
- textBaseline: 'bottom'
66376
+ textAlign: syncAxisLabelAngle && axisLabel ? (_g = axisLabel.attribute.textAlign) !== null && _g !== void 0 ? _g : 'center' : 'center',
66377
+ textBaseline: syncAxisLabelAngle && axisLabel ? (_h = axisLabel.attribute.textBaseline) !== null && _h !== void 0 ? _h : 'bottom' : 'bottom'
66326
66378
  };
66327
66379
  }
66328
66380
  else if (axisOrient === 'bottom') {
66329
66381
  newCacheInfo.labels[axisOrient].dy = labelOffset;
66330
66382
  newCacheInfo.labelsTextStyle[axisOrient] = {
66331
- textAlign: 'center',
66332
- textBaseline: 'top'
66383
+ textAlign: syncAxisLabelAngle && axisLabel ? (_j = axisLabel.attribute.textAlign) !== null && _j !== void 0 ? _j : 'center' : 'center',
66384
+ textBaseline: syncAxisLabelAngle && axisLabel ? (_k = axisLabel.attribute.textBaseline) !== null && _k !== void 0 ? _k : 'top' : 'top'
66333
66385
  };
66334
66386
  }
66335
66387
  newCacheInfo.labels[axisOrient].defaultFormatter = niceLabelFormatter;
@@ -67479,6 +67531,26 @@
67479
67531
  this._barMarkType = "rect";
67480
67532
  this.transformerConstructor = BarSeriesSpecTransformer;
67481
67533
  this._bandPosition = 0;
67534
+ this._getLinearBarRange = (start, end) => {
67535
+ let [x, x1] = [start, end].sort((a, b) => a - b);
67536
+ const realBarWidth = x1 - x;
67537
+ if (this._spec.barGap) {
67538
+ const halfBarGap = this._spec.barGap * 0.5;
67539
+ const tempX = x + halfBarGap;
67540
+ const tempX1 = x1 - halfBarGap;
67541
+ x = tempX;
67542
+ x1 = tempX1;
67543
+ }
67544
+ const curBarWidth = x1 - x;
67545
+ const barMinWidth = getActualNumValue(this._spec.barMinWidth || 2, realBarWidth);
67546
+ if (curBarWidth < barMinWidth) {
67547
+ const widthDiff = barMinWidth - curBarWidth;
67548
+ const halfWidthDiff = widthDiff / 2;
67549
+ x -= halfWidthDiff;
67550
+ x1 += halfWidthDiff;
67551
+ }
67552
+ return [x, x1];
67553
+ };
67482
67554
  this._getBarXStart = (datum, scale, useWholeRange) => {
67483
67555
  if (this._shouldDoPreCalculate()) {
67484
67556
  this._calculateStackRectPosition(false);
@@ -67496,6 +67568,11 @@
67496
67568
  }
67497
67569
  return valueInScaleRange(this._dataToPosX1(datum), scale, useWholeRange);
67498
67570
  };
67571
+ this._getLinearBarXRange = (datum, scale, useWholeRange) => {
67572
+ const x = valueInScaleRange(this._dataToPosX(datum), scale, useWholeRange);
67573
+ const x1 = valueInScaleRange(this._dataToPosX1(datum), scale, useWholeRange);
67574
+ return this._getLinearBarRange(x, x1);
67575
+ };
67499
67576
  this._getBarYStart = (datum, scale) => {
67500
67577
  if (this._shouldDoPreCalculate()) {
67501
67578
  this._calculateStackRectPosition(true);
@@ -67513,6 +67590,11 @@
67513
67590
  }
67514
67591
  return valueInScaleRange(this._dataToPosY1(datum), scale);
67515
67592
  };
67593
+ this._getLinearBarYRange = (datum, scale, useWholeRange) => {
67594
+ const y = valueInScaleRange(this._dataToPosY(datum), scale, useWholeRange);
67595
+ const y1 = valueInScaleRange(this._dataToPosY1(datum), scale, useWholeRange);
67596
+ return this._getLinearBarRange(y, y1);
67597
+ };
67516
67598
  this._getBarBackgroundXStart = (scale) => {
67517
67599
  const range = scale.range();
67518
67600
  const min = Math.min(range[0], range[range.length - 1]);
@@ -67866,8 +67948,8 @@
67866
67948
  if (this.direction === "horizontal") {
67867
67949
  const yChannels = isValid$1(this._fieldY2)
67868
67950
  ? {
67869
- y: (datum) => valueInScaleRange(this._dataToPosY(datum), yScale, true),
67870
- y1: (datum) => valueInScaleRange(this._dataToPosY1(datum), yScale, true)
67951
+ y: (datum) => this._getLinearBarYRange(datum, yScale, true)[0],
67952
+ y1: (datum) => this._getLinearBarYRange(datum, yScale, true)[1]
67871
67953
  }
67872
67954
  : {
67873
67955
  y: (datum) => valueInScaleRange(this._dataToPosY(datum) - this._getBarWidth(this._yAxisHelper) / 2, yScale, true),
@@ -67879,8 +67961,8 @@
67879
67961
  else {
67880
67962
  const xChannels = isValid$1(this._fieldX2)
67881
67963
  ? {
67882
- x: (datum) => valueInScaleRange(this._dataToPosX(datum), xScale, true),
67883
- x1: (datum) => valueInScaleRange(this._dataToPosX1(datum), xScale, true)
67964
+ x: (datum) => this._getLinearBarXRange(datum, xScale, true)[0],
67965
+ x1: (datum) => this._getLinearBarXRange(datum, xScale, true)[1]
67884
67966
  }
67885
67967
  : {
67886
67968
  x: (datum) => valueInScaleRange(this._dataToPosX(datum) - this._getBarWidth(this._xAxisHelper) / 2, xScale, true),
@@ -87092,7 +87174,7 @@
87092
87174
  spec.axes.forEach((axis) => (axis.type = 'linear'));
87093
87175
  }
87094
87176
  _getDefaultSeriesSpec(spec) {
87095
- return super._getDefaultSeriesSpec(spec, ['x2Field', 'y2Field', 'barMinHeight', 'barBackground']);
87177
+ return super._getDefaultSeriesSpec(spec, ['x2Field', 'y2Field', 'barMinHeight', 'barBackground', 'barGap']);
87096
87178
  }
87097
87179
  }
87098
87180
 
@@ -89384,11 +89466,13 @@
89384
89466
  return false;
89385
89467
  }
89386
89468
  _initTheme(spec, chartSpec) {
89387
- var _a;
89469
+ var _a, _b, _c;
89388
89470
  const { spec: newSpec, theme } = super._initTheme(spec, chartSpec);
89389
89471
  newSpec.style = mergeSpec({}, this._theme, newSpec.style);
89390
89472
  newSpec.offset = mergeSpec({}, theme.offset, spec.offset);
89391
89473
  newSpec.transitionDuration = (_a = spec.transitionDuration) !== null && _a !== void 0 ? _a : theme.transitionDuration;
89474
+ newSpec.trigger = (_b = spec.trigger) !== null && _b !== void 0 ? _b : theme.trigger;
89475
+ newSpec.triggerOff = (_c = spec.triggerOff) !== null && _c !== void 0 ? _c : theme.triggerOff;
89392
89476
  return { spec: newSpec, theme };
89393
89477
  }
89394
89478
  _transformSpecAfterMergingTheme(spec, chartSpec, chartSpecInfo) {
@@ -90378,7 +90462,7 @@
90378
90462
  }
90379
90463
  }
90380
90464
  _parseField(field, fieldName) {
90381
- var _a, _b;
90465
+ var _a, _b, _c;
90382
90466
  const hair = {};
90383
90467
  const { line = {}, label = {}, visible } = field;
90384
90468
  hair.visible = visible;
@@ -90389,7 +90473,7 @@
90389
90473
  else {
90390
90474
  const style = line.style || {};
90391
90475
  const { stroke, fill, lineWidth } = style;
90392
- const _c = style, { strokeOpacity, fillOpacity, opacity } = _c, restStyle = __rest$e(_c, ["strokeOpacity", "fillOpacity", "opacity"]);
90476
+ const _d = style, { strokeOpacity, fillOpacity, opacity } = _d, restStyle = __rest$e(_d, ["strokeOpacity", "fillOpacity", "opacity"]);
90393
90477
  const isLineType = hair.type === 'line';
90394
90478
  let finalOpacity = isLineType ? strokeOpacity : fillOpacity;
90395
90479
  if (isNumber$1(opacity)) {
@@ -90417,8 +90501,9 @@
90417
90501
  }
90418
90502
  if (!!label.visible) {
90419
90503
  const labelBackground = label.labelBackground || {};
90504
+ const syncAxisLabelAngle = (_c = label.syncAxisLabelAngle) !== null && _c !== void 0 ? _c : false;
90420
90505
  const labelStyle = label.style || {};
90421
- const _d = labelBackground.style || {}, { fill: rectFill = 'rgba(47, 59, 82, 0.9)', stroke: rectStroke, outerBorder } = _d, rectStyle = __rest$e(_d, ["fill", "stroke", "outerBorder"]);
90506
+ const _e = labelBackground.style || {}, { fill: rectFill = 'rgba(47, 59, 82, 0.9)', stroke: rectStroke, outerBorder } = _e, rectStyle = __rest$e(_e, ["fill", "stroke", "outerBorder"]);
90422
90507
  hair.label = {
90423
90508
  visible: true,
90424
90509
  formatMethod: label.formatMethod,
@@ -90426,6 +90511,7 @@
90426
90511
  minWidth: labelBackground.minWidth,
90427
90512
  maxWidth: labelBackground.maxWidth,
90428
90513
  padding: labelBackground.padding,
90514
+ syncAxisLabelAngle,
90429
90515
  textStyle: Object.assign(Object.assign({ fontSize: 14, pickable: false }, labelStyle), { fill: labelStyle.fill || '#fff', stroke: get$1(labelStyle, 'stroke') }),
90430
90516
  panel: (isBoolean$1(labelBackground.visible) ? labelBackground.visible : !!labelBackground)
90431
90517
  ? Object.assign({ visible: true, pickable: false, fill: rectFill, stroke: rectStroke, outerBorder: Object.assign({ stroke: rectFill, distance: 0, lineWidth: 3 }, outerBorder) }, rectStyle) : { visible: false },
@@ -90693,9 +90779,9 @@
90693
90779
  const positionAttribute = layoutCrosshair$1(this._stateByField[field]);
90694
90780
  this._updateCrosshairByField(field, positionAttribute);
90695
90781
  Object.keys(labels).forEach(labelKey => {
90696
- var _a;
90782
+ var _a, _b, _c;
90697
90783
  if (labels[labelKey].visible) {
90698
- const updateAttrs = Object.assign(Object.assign(Object.assign({ [coordKey]: coord + bandSize / 2 }, labels[labelKey]), attributes.label), { textStyle: Object.assign(Object.assign({}, (_a = attributes.label) === null || _a === void 0 ? void 0 : _a.textStyle), labelsTextStyle[labelKey]), zIndex: this.labelZIndex, visible: true });
90784
+ const updateAttrs = Object.assign(Object.assign(Object.assign({ [coordKey]: coord + bandSize / 2 }, labels[labelKey]), attributes.label), { angle: attributes.label.syncAxisLabelAngle ? (_b = (_a = cacheInfo.axisLabel) === null || _a === void 0 ? void 0 : _a.attribute.angle) !== null && _b !== void 0 ? _b : 0 : 0, textStyle: Object.assign(Object.assign({}, (_c = attributes.label) === null || _c === void 0 ? void 0 : _c.textStyle), labelsTextStyle[labelKey]), zIndex: this.labelZIndex, visible: true });
90699
90785
  this._updateCrosshairLabel(labelsComp[labelKey], updateAttrs, label => {
90700
90786
  label.name = `crosshair-${field.replace('Field', '')}-${labelKey}-label`;
90701
90787
  labelsComp[labelKey] = label;
@@ -92836,7 +92922,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92836
92922
  x = convertPercentToValue(datum.x, regionWidth) + regionStartLayoutStartPoint.x;
92837
92923
  }
92838
92924
  else {
92839
- x = relativeSeries.getXAxisHelper().dataToPosition([datum.x]) + regionStartLayoutStartPoint.x;
92925
+ x =
92926
+ convertDatumToValue(relativeSeries.getXAxisHelper(), [datum.x]) +
92927
+ regionStartLayoutStartPoint.x;
92840
92928
  }
92841
92929
  return x;
92842
92930
  }
@@ -92851,7 +92939,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92851
92939
  y = convertPercentToValue(datum.y, regionHeight) + regionStartLayoutStartPoint.y;
92852
92940
  }
92853
92941
  else {
92854
- y = relativeSeries.getYAxisHelper().dataToPosition([datum.y]) + regionStartLayoutStartPoint.y;
92942
+ y =
92943
+ convertDatumToValue(relativeSeries.getYAxisHelper(), [datum.y]) +
92944
+ regionStartLayoutStartPoint.y;
92855
92945
  }
92856
92946
  return y;
92857
92947
  }
@@ -92861,7 +92951,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92861
92951
  isNumber$1(datum.angle) &&
92862
92952
  isNeedExtendDomain(angleDomain, datum.angle, autoRange) &&
92863
92953
  ((_b = (_a = relativeSeries.angleAxisHelper) === null || _a === void 0 ? void 0 : _a.setExtendDomain) === null || _b === void 0 ? void 0 : _b.call(_a, 'marker_angleAxis_extend', datum.angle));
92864
- return relativeSeries.angleAxisHelper.dataToPosition([datum.angle]);
92954
+ return convertDatumToValue(relativeSeries.angleAxisHelper, [datum.angle]);
92865
92955
  }
92866
92956
  function getRadiusValue(datum, radiusDomain, autoRange, refSeries) {
92867
92957
  var _a, _b;
@@ -92869,11 +92959,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92869
92959
  isNumber$1(datum.radius) &&
92870
92960
  isNeedExtendDomain(radiusDomain, datum.radius, autoRange) &&
92871
92961
  ((_b = (_a = relativeSeries.radiusAxisHelper) === null || _a === void 0 ? void 0 : _a.setExtendDomain) === null || _b === void 0 ? void 0 : _b.call(_a, 'marker_radiusAxis_extend', datum.radius));
92872
- return relativeSeries.radiusAxisHelper.dataToPosition([datum.radius]);
92962
+ return convertDatumToValue(relativeSeries.radiusAxisHelper, [datum.radius]);
92873
92963
  }
92874
92964
  function convertPercentToValue(percent, relativeLength) {
92875
92965
  return (Number(percent.substring(0, percent.length - 1)) * relativeLength) / 100;
92876
92966
  }
92967
+ function convertDatumToValue(axisHelper, datum) {
92968
+ const scale = axisHelper.getScale(0);
92969
+ if (isContinuous(scale.type) && scale.domain()[0] === scale.domain()[1] && datum[0] !== scale.domain()[0]) {
92970
+ return NaN;
92971
+ }
92972
+ return axisHelper.dataToPosition(datum);
92973
+ }
92877
92974
  function isAggrSpec(spec) {
92878
92975
  return AGGR_TYPE.includes(spec);
92879
92976
  }
@@ -93038,8 +93135,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93038
93135
  isNeedExtendDomain(yDomain, yValue[0], autoRange) &&
93039
93136
  ((_d = (_c = refRelativeSeries.getYAxisHelper()) === null || _c === void 0 ? void 0 : _c.setExtendDomain) === null || _d === void 0 ? void 0 : _d.call(_c, 'marker_yAxis_extend', yValue[0]));
93040
93137
  points.push({
93041
- x: refRelativeSeries.getXAxisHelper().dataToPosition(xValue) + regionStartLayoutStartPoint.x + offsetX,
93042
- y: refRelativeSeries.getYAxisHelper().dataToPosition(yValue) + regionStartLayoutStartPoint.y + offsetY
93138
+ x: convertDatumToValue(refRelativeSeries.getXAxisHelper(), xValue) + regionStartLayoutStartPoint.x + offsetX,
93139
+ y: convertDatumToValue(refRelativeSeries.getYAxisHelper(), yValue) + regionStartLayoutStartPoint.y + offsetY
93043
93140
  });
93044
93141
  });
93045
93142
  return points;
@@ -93063,8 +93160,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93063
93160
  isNeedExtendDomain(radiusDomain, radiusValue[0], autoRange) &&
93064
93161
  ((_d = (_c = refRelativeSeries.radiusAxisHelper) === null || _c === void 0 ? void 0 : _c.setExtendDomain) === null || _d === void 0 ? void 0 : _d.call(_c, 'marker_yAxis_extend', radiusValue[0]));
93065
93162
  points.push({
93066
- angle: refRelativeSeries.angleAxisHelper.dataToPosition(angleValue),
93067
- radius: refRelativeSeries.radiusAxisHelper.dataToPosition(radiusValue)
93163
+ angle: convertDatumToValue(refRelativeSeries.angleAxisHelper, angleValue),
93164
+ radius: convertDatumToValue(refRelativeSeries.radiusAxisHelper, radiusValue)
93068
93165
  });
93069
93166
  });
93070
93167
  return points;
@@ -96147,7 +96244,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96147
96244
  this._linkedInBrushElementsMap = {};
96148
96245
  this._linkedOutOfBrushElementsMap = {};
96149
96246
  this._cacheInteractiveRangeAttrs = [];
96150
- this._needDisablePickable = false;
96151
96247
  this._releatedAxes = [];
96152
96248
  this._regionAxisMap = {};
96153
96249
  this._axisDataZoomMap = {};
@@ -96299,34 +96395,36 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96299
96395
  this._emitEvent(exports.ChartEvent.brushActive, region);
96300
96396
  });
96301
96397
  brush.addEventListener(IOperateType.drawStart, (e) => {
96398
+ this._setRegionMarkPickable(region, true);
96302
96399
  this._emitEvent(exports.ChartEvent.brushStart, region);
96303
96400
  });
96304
96401
  brush.addEventListener(IOperateType.moveStart, (e) => {
96402
+ this._setRegionMarkPickable(region, true);
96305
96403
  this._emitEvent(exports.ChartEvent.brushStart, region);
96306
96404
  });
96307
96405
  brush.addEventListener(IOperateType.drawing, (e) => {
96308
- this._needDisablePickable = true;
96406
+ this._setRegionMarkPickable(region, false);
96309
96407
  this._handleBrushChange(region, e);
96310
96408
  this._emitEvent(exports.ChartEvent.brushChange, region);
96311
96409
  });
96312
96410
  brush.addEventListener(IOperateType.moving, (e) => {
96411
+ this._setRegionMarkPickable(region, false);
96313
96412
  this._handleBrushChange(region, e);
96314
96413
  this._emitEvent(exports.ChartEvent.brushChange, region);
96315
96414
  });
96316
96415
  brush.addEventListener(IOperateType.brushClear, (e) => {
96416
+ this._setRegionMarkPickable(region, true);
96317
96417
  this._initMarkBrushState(componentIndex, '');
96318
- this._needDisablePickable = false;
96319
96418
  this._emitEvent(exports.ChartEvent.brushClear, region);
96320
96419
  });
96321
96420
  brush.addEventListener(IOperateType.drawEnd, (e) => {
96322
96421
  var _a;
96323
- this._needDisablePickable = false;
96422
+ this._setRegionMarkPickable(region, true);
96324
96423
  const { operateMask } = e.detail;
96325
96424
  if ((_a = this._spec) === null || _a === void 0 ? void 0 : _a.onBrushEnd) {
96326
96425
  if (this._spec.onBrushEnd(e) === true) {
96327
96426
  this.clearGraphic();
96328
96427
  this._initMarkBrushState(componentIndex, '');
96329
- this._needDisablePickable = false;
96330
96428
  this._emitEvent(exports.ChartEvent.brushClear, region);
96331
96429
  }
96332
96430
  else {
@@ -96343,6 +96441,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96343
96441
  }
96344
96442
  });
96345
96443
  brush.addEventListener(IOperateType.moveEnd, (e) => {
96444
+ this._setRegionMarkPickable(region, true);
96346
96445
  const { operateMask } = e.detail;
96347
96446
  const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
96348
96447
  if (!this._spec.zoomWhenEmpty && inBrushData.length > 0) {
@@ -96468,7 +96567,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96468
96567
  this._outOfBrushElementsMap[elementKey] = graphicItem;
96469
96568
  delete this._inBrushElementsMap[operateMask.name][elementKey];
96470
96569
  }
96471
- graphicItem.setAttribute('pickable', !this._needDisablePickable);
96472
96570
  });
96473
96571
  });
96474
96572
  }
@@ -96526,7 +96624,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96526
96624
  graphicItem.addState(OUT_BRUSH_STATE, true);
96527
96625
  this._linkedOutOfBrushElementsMap[elementKey] = graphicItem;
96528
96626
  }
96529
- graphicItem.setAttribute('pickable', !this._needDisablePickable);
96530
96627
  });
96531
96628
  });
96532
96629
  }
@@ -96592,6 +96689,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96592
96689
  this._initItemMap(this._itemMap, this._outOfBrushElementsMap, stateName);
96593
96690
  this._initItemMap(this._linkedItemMap, this._linkedOutOfBrushElementsMap, stateName);
96594
96691
  }
96692
+ _setRegionMarkPickable(region, pickable) {
96693
+ region
96694
+ .getGroupMark()
96695
+ .getGraphics()
96696
+ .forEach(g => g.setAttribute('childrenPickable', pickable));
96697
+ }
96595
96698
  _stateClamp(state) {
96596
96699
  return Math.min(Math.max(0, state), 1);
96597
96700
  }
@@ -96671,7 +96774,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96671
96774
  const container = this.getContainer();
96672
96775
  this._brushComponents.forEach((brush, index) => {
96673
96776
  this._initMarkBrushState(index, '');
96674
- this._needDisablePickable = false;
96675
96777
  brush.removeAllChild();
96676
96778
  brush.releaseBrushEvents();
96677
96779
  if (container) {
@@ -97897,12 +97999,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97897
97999
  const rowStyle = this._domStyle.row;
97898
98000
  const chilren = [...this._rootDom.children];
97899
98001
  let titleDom = chilren.find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));
98002
+ let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));
97900
98003
  if (!titleDom && title.visible !== false) {
97901
98004
  titleDom = document.createElement('h2');
97902
98005
  const span = document.createElement('span');
97903
98006
  titleDom.appendChild(span);
97904
98007
  titleDom.classList.add(TOOLTIP_TITLE_CLASS_NAME);
97905
- this._rootDom.appendChild(titleDom);
98008
+ if (this._rootDom.firstChild) {
98009
+ this._rootDom.insertBefore(titleDom, this._rootDom.firstChild);
98010
+ }
98011
+ else {
98012
+ this._rootDom.appendChild(titleDom);
98013
+ }
97906
98014
  }
97907
98015
  if (titleDom && title.visible !== false) {
97908
98016
  setStyleToDom(titleDom, Object.assign(Object.assign(Object.assign({}, this._domStyle.title), (hasContent ? rowStyle : { marginBottom: '0px' })), { marginTop: '0px' }));
@@ -97911,7 +98019,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97911
98019
  else if (titleDom && title.visible === false) {
97912
98020
  titleDom.parentNode.removeChild(titleDom);
97913
98021
  }
97914
- let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));
97915
98022
  const columns = ['shape', 'key', 'value'];
97916
98023
  if (!contentDom && hasContent) {
97917
98024
  contentDom = document.createElement('div');