@visactor/vchart 1.1.0-beta.3 → 1.1.0-beta.5

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 (199) hide show
  1. package/build/index.js +489 -389
  2. package/build/index.min.js +2 -2
  3. package/cjs/chart/base-chart.d.ts +3 -1
  4. package/cjs/chart/base-chart.js +34 -1
  5. package/cjs/chart/base-chart.js.map +1 -1
  6. package/cjs/chart/box-plot/box-plot.js +3 -8
  7. package/cjs/chart/box-plot/box-plot.js.map +1 -1
  8. package/cjs/chart/interface/chart.d.ts +10 -1
  9. package/cjs/chart/interface/chart.js.map +1 -1
  10. package/cjs/component/axis/base-axis.js +1 -14
  11. package/cjs/component/axis/base-axis.js.map +1 -1
  12. package/cjs/component/axis/interface.d.ts +1 -0
  13. package/cjs/component/axis/interface.js.map +1 -1
  14. package/cjs/component/axis/mixin/band-axis-mixin.d.ts +16 -0
  15. package/cjs/component/axis/mixin/band-axis-mixin.js +15 -1
  16. package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
  17. package/cjs/component/crosshair/cartesian.d.ts +2 -0
  18. package/cjs/component/crosshair/cartesian.js +11 -2
  19. package/cjs/component/crosshair/cartesian.js.map +1 -1
  20. package/cjs/component/crosshair/interface/spec.d.ts +6 -1
  21. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  22. package/cjs/component/tooltip/handler/base.js.map +1 -1
  23. package/cjs/component/tooltip/handler/constants.d.ts +1 -1
  24. package/cjs/component/tooltip/handler/constants.js +2 -2
  25. package/cjs/component/tooltip/handler/constants.js.map +1 -1
  26. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js +8 -8
  27. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  28. package/cjs/component/tooltip/handler/dom/interface.d.ts +3 -0
  29. package/cjs/component/tooltip/handler/dom/interface.js.map +1 -1
  30. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.d.ts +0 -1
  31. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.js +4 -2
  32. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.js.map +1 -1
  33. package/cjs/component/tooltip/handler/dom/model/content-column-model.d.ts +3 -0
  34. package/cjs/component/tooltip/handler/dom/model/content-column-model.js +34 -33
  35. package/cjs/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  36. package/cjs/component/tooltip/handler/dom/model/interface.d.ts +2 -0
  37. package/cjs/component/tooltip/handler/dom/model/interface.js.map +1 -1
  38. package/cjs/component/tooltip/handler/dom/model/shape-model.d.ts +1 -0
  39. package/cjs/component/tooltip/handler/dom/model/shape-model.js +3 -3
  40. package/cjs/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  41. package/cjs/component/tooltip/handler/dom/model/text-model.d.ts +1 -1
  42. package/cjs/component/tooltip/handler/dom/model/text-model.js +3 -2
  43. package/cjs/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  44. package/cjs/component/tooltip/handler/dom/model/title-model.js +3 -3
  45. package/cjs/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  46. package/cjs/component/tooltip/handler/dom/util.d.ts +1 -0
  47. package/cjs/component/tooltip/handler/dom/util.js +28 -27
  48. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  49. package/cjs/component/tooltip/handler/interface/style.d.ts +10 -7
  50. package/cjs/component/tooltip/handler/interface/style.js.map +1 -1
  51. package/cjs/component/tooltip/handler/utils/attribute.d.ts +9 -2
  52. package/cjs/component/tooltip/handler/utils/attribute.js +58 -9
  53. package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
  54. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  55. package/cjs/component/tooltip/handler/utils/style.d.ts +2 -2
  56. package/cjs/component/tooltip/handler/utils/style.js +5 -2
  57. package/cjs/component/tooltip/handler/utils/style.js.map +1 -1
  58. package/cjs/component/tooltip/interface/common.d.ts +6 -0
  59. package/cjs/component/tooltip/interface/common.js.map +1 -1
  60. package/cjs/component/tooltip/interface/theme.d.ts +4 -0
  61. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  62. package/cjs/component/tooltip/tooltip.d.ts +3 -2
  63. package/cjs/component/tooltip/tooltip.js +8 -4
  64. package/cjs/component/tooltip/tooltip.js.map +1 -1
  65. package/cjs/component/tooltip/utils/show-tooltip.js +9 -4
  66. package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
  67. package/cjs/constant/scatter.js +1 -2
  68. package/cjs/core/factory.js +2 -1
  69. package/cjs/core/index.d.ts +1 -1
  70. package/cjs/core/index.js +1 -1
  71. package/cjs/core/index.js.map +1 -1
  72. package/cjs/core/instance-manager.d.ts +2 -1
  73. package/cjs/core/instance-manager.js +7 -2
  74. package/cjs/core/instance-manager.js.map +1 -1
  75. package/cjs/core/interface.d.ts +3 -0
  76. package/cjs/core/interface.js.map +1 -1
  77. package/cjs/core/vchart.d.ts +5 -3
  78. package/cjs/core/vchart.js +9 -3
  79. package/cjs/core/vchart.js.map +1 -1
  80. package/cjs/data/transforms/legend-data/discrete/discrete.js +3 -3
  81. package/cjs/data/transforms/legend-data/discrete/discrete.js.map +1 -1
  82. package/cjs/event/event.d.ts +5 -1
  83. package/cjs/event/event.js +3 -0
  84. package/cjs/event/event.js.map +1 -1
  85. package/cjs/event/events/dimension/base.d.ts +4 -0
  86. package/cjs/event/events/dimension/base.js +16 -1
  87. package/cjs/event/events/dimension/base.js.map +1 -1
  88. package/cjs/event/events/dimension/util/cartesian.d.ts +4 -0
  89. package/cjs/event/events/dimension/util/cartesian.js +37 -46
  90. package/cjs/event/events/dimension/util/cartesian.js.map +1 -1
  91. package/cjs/event/interface.d.ts +5 -0
  92. package/cjs/event/interface.js.map +1 -1
  93. package/cjs/interaction/dimension-trigger.js +3 -3
  94. package/cjs/interaction/dimension-trigger.js.map +1 -1
  95. package/cjs/util/env.d.ts +1 -0
  96. package/cjs/util/env.js +3 -2
  97. package/cjs/util/env.js.map +1 -1
  98. package/cjs/util/text.d.ts +4 -0
  99. package/cjs/util/text.js +9 -1
  100. package/cjs/util/text.js.map +1 -1
  101. package/esm/chart/base-chart.d.ts +3 -1
  102. package/esm/chart/base-chart.js +35 -0
  103. package/esm/chart/base-chart.js.map +1 -1
  104. package/esm/chart/box-plot/box-plot.js +2 -9
  105. package/esm/chart/box-plot/box-plot.js.map +1 -1
  106. package/esm/chart/interface/chart.d.ts +10 -1
  107. package/esm/chart/interface/chart.js.map +1 -1
  108. package/esm/component/axis/base-axis.js +1 -14
  109. package/esm/component/axis/base-axis.js.map +1 -1
  110. package/esm/component/axis/interface.d.ts +1 -0
  111. package/esm/component/axis/interface.js.map +1 -1
  112. package/esm/component/axis/mixin/band-axis-mixin.d.ts +16 -0
  113. package/esm/component/axis/mixin/band-axis-mixin.js +16 -0
  114. package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
  115. package/esm/component/crosshair/cartesian.d.ts +2 -0
  116. package/esm/component/crosshair/cartesian.js +12 -1
  117. package/esm/component/crosshair/cartesian.js.map +1 -1
  118. package/esm/component/crosshair/interface/spec.d.ts +6 -1
  119. package/esm/component/crosshair/interface/spec.js.map +1 -1
  120. package/esm/component/tooltip/handler/base.js.map +1 -1
  121. package/esm/component/tooltip/handler/constants.d.ts +1 -1
  122. package/esm/component/tooltip/handler/constants.js +1 -1
  123. package/esm/component/tooltip/handler/constants.js.map +1 -1
  124. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js +5 -5
  125. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  126. package/esm/component/tooltip/handler/dom/interface.d.ts +3 -0
  127. package/esm/component/tooltip/handler/dom/interface.js.map +1 -1
  128. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.d.ts +0 -1
  129. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.js +1 -1
  130. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.js.map +1 -1
  131. package/esm/component/tooltip/handler/dom/model/content-column-model.d.ts +3 -0
  132. package/esm/component/tooltip/handler/dom/model/content-column-model.js +33 -31
  133. package/esm/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  134. package/esm/component/tooltip/handler/dom/model/interface.d.ts +2 -0
  135. package/esm/component/tooltip/handler/dom/model/interface.js.map +1 -1
  136. package/esm/component/tooltip/handler/dom/model/shape-model.d.ts +1 -0
  137. package/esm/component/tooltip/handler/dom/model/shape-model.js +3 -3
  138. package/esm/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  139. package/esm/component/tooltip/handler/dom/model/text-model.d.ts +1 -1
  140. package/esm/component/tooltip/handler/dom/model/text-model.js +3 -2
  141. package/esm/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  142. package/esm/component/tooltip/handler/dom/model/title-model.js +3 -3
  143. package/esm/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  144. package/esm/component/tooltip/handler/dom/util.d.ts +1 -0
  145. package/esm/component/tooltip/handler/dom/util.js +8 -5
  146. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  147. package/esm/component/tooltip/handler/interface/style.d.ts +10 -7
  148. package/esm/component/tooltip/handler/interface/style.js.map +1 -1
  149. package/esm/component/tooltip/handler/utils/attribute.d.ts +9 -2
  150. package/esm/component/tooltip/handler/utils/attribute.js +56 -8
  151. package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
  152. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  153. package/esm/component/tooltip/handler/utils/style.d.ts +2 -2
  154. package/esm/component/tooltip/handler/utils/style.js +5 -2
  155. package/esm/component/tooltip/handler/utils/style.js.map +1 -1
  156. package/esm/component/tooltip/interface/common.d.ts +6 -0
  157. package/esm/component/tooltip/interface/common.js.map +1 -1
  158. package/esm/component/tooltip/interface/theme.d.ts +4 -0
  159. package/esm/component/tooltip/interface/theme.js.map +1 -1
  160. package/esm/component/tooltip/tooltip.d.ts +3 -2
  161. package/esm/component/tooltip/tooltip.js +10 -4
  162. package/esm/component/tooltip/tooltip.js.map +1 -1
  163. package/esm/component/tooltip/utils/show-tooltip.js +9 -4
  164. package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
  165. package/esm/constant/scatter.js +1 -2
  166. package/esm/core/factory.js +2 -1
  167. package/esm/core/index.d.ts +1 -1
  168. package/esm/core/index.js +1 -1
  169. package/esm/core/index.js.map +1 -1
  170. package/esm/core/instance-manager.d.ts +2 -1
  171. package/esm/core/instance-manager.js +7 -2
  172. package/esm/core/instance-manager.js.map +1 -1
  173. package/esm/core/interface.d.ts +3 -0
  174. package/esm/core/interface.js.map +1 -1
  175. package/esm/core/vchart.d.ts +5 -3
  176. package/esm/core/vchart.js +9 -3
  177. package/esm/core/vchart.js.map +1 -1
  178. package/esm/data/transforms/legend-data/discrete/discrete.js +3 -3
  179. package/esm/data/transforms/legend-data/discrete/discrete.js.map +1 -1
  180. package/esm/event/event.d.ts +5 -1
  181. package/esm/event/event.js +3 -0
  182. package/esm/event/event.js.map +1 -1
  183. package/esm/event/events/dimension/base.d.ts +4 -0
  184. package/esm/event/events/dimension/base.js +18 -1
  185. package/esm/event/events/dimension/base.js.map +1 -1
  186. package/esm/event/events/dimension/util/cartesian.d.ts +4 -0
  187. package/esm/event/events/dimension/util/cartesian.js +32 -44
  188. package/esm/event/events/dimension/util/cartesian.js.map +1 -1
  189. package/esm/event/interface.d.ts +5 -0
  190. package/esm/event/interface.js.map +1 -1
  191. package/esm/interaction/dimension-trigger.js +2 -4
  192. package/esm/interaction/dimension-trigger.js.map +1 -1
  193. package/esm/util/env.d.ts +1 -0
  194. package/esm/util/env.js +2 -0
  195. package/esm/util/env.js.map +1 -1
  196. package/esm/util/text.d.ts +4 -0
  197. package/esm/util/text.js +7 -1
  198. package/esm/util/text.js.map +1 -1
  199. package/package.json +7 -7
package/build/index.js CHANGED
@@ -7392,6 +7392,7 @@
7392
7392
  };
7393
7393
 
7394
7394
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
7395
+ const domDocument = isBrowser && globalThis.document;
7395
7396
  function isTrueBrowser(mode) {
7396
7397
  return (mode === 'desktop-browser' || mode === 'mobile-browser') && isBrowser;
7397
7398
  }
@@ -15570,7 +15571,7 @@
15570
15571
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
15571
15572
  }
15572
15573
  insertInto(newNode, idx) {
15573
- if (this._nodeList && console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
15574
+ if (!this._ignoreWarn && this._nodeList && console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
15574
15575
  if (this._uid === newNode._uid) return null;
15575
15576
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
15576
15577
  if (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, 0 === idx) newNode._next = this._firstChild, this._firstChild && (this._firstChild._prev = newNode), newNode._prev = null, this._firstChild = newNode;else {
@@ -15592,7 +15593,10 @@
15592
15593
  let node;
15593
15594
  this._nodeList[idx] = newNode;
15594
15595
  for (let i = idx - 1; i >= 0 && (node = this._nodeList[i], !node); i--);
15595
- return node ? node._next ? this.insertBefore(newNode, node._next) : this.appendChild(newNode) : this.insertInto(newNode, 0);
15596
+ if (node) return node._next ? this.insertBefore(newNode, node._next) : this.appendChild(newNode);
15597
+ this._ignoreWarn = !0;
15598
+ const data = this.insertInto(newNode, 0);
15599
+ return this._ignoreWarn = !1, data;
15596
15600
  }
15597
15601
  removeChild(child) {
15598
15602
  if (!this._idMap) return null;
@@ -23609,6 +23613,7 @@
23609
23613
  function getTextBounds(params) {
23610
23614
  return text.setAttributes(params), text.AABBBounds;
23611
23615
  }
23616
+ createRichText({});
23612
23617
 
23613
23618
  class DefaultCanvasAllocate {
23614
23619
  constructor() {
@@ -23995,7 +24000,7 @@
23995
24000
  isFullStroke: isFullStroke,
23996
24001
  stroke: arrayStroke
23997
24002
  } = parseStroke(stroke);
23998
- if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), this._arcRenderContribitions || (this._arcRenderContribitions = this.arcRenderContribitions.getContributions() || [], this._arcRenderContribitions.sort((a, b) => b.order - a.order)), this._arcRenderContribitions.forEach(c => {
24003
+ if ((doFill || isFullStroke || background) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), this._arcRenderContribitions || (this._arcRenderContribitions = this.arcRenderContribitions.getContributions() || [], this._arcRenderContribitions.sort((a, b) => b.order - a.order)), this._arcRenderContribitions.forEach(c => {
23999
24004
  c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, fillCb, strokeCb);
24000
24005
  }), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill())), doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()))), !isFullStroke && doStroke) {
24001
24006
  context.beginPath();
@@ -28590,6 +28595,25 @@
28590
28595
  _context.setLineDash(lineDash);
28591
28596
  }
28592
28597
  }
28598
+ _setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {
28599
+ const _context = this.nativeContext;
28600
+ defaultParams || (defaultParams = this.strokeAttributes);
28601
+ const {
28602
+ strokeOpacity = defaultParams.strokeOpacity,
28603
+ opacity = defaultParams.opacity
28604
+ } = attribute;
28605
+ if (strokeOpacity > 1e-12 && opacity > 1e-12) {
28606
+ const {
28607
+ lineWidth = defaultParams.lineWidth,
28608
+ stroke = defaultParams.stroke,
28609
+ lineJoin = defaultParams.lineJoin,
28610
+ lineDash = defaultParams.lineDash,
28611
+ lineCap = defaultParams.lineCap,
28612
+ miterLimit = defaultParams.miterLimit
28613
+ } = attribute;
28614
+ _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
28615
+ }
28616
+ }
28593
28617
  draw() {
28594
28618
  const _context = this.nativeContext;
28595
28619
  this.drawPromise = new Promise(resolve => {
@@ -33701,7 +33725,10 @@
33701
33725
  let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33702
33726
  if (this.graphicItem) return;
33703
33727
  const attrs = Object.assign({}, attributes);
33704
- this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey), this.graphicItem[BridgeElementKey] = this, this.graphicItem.onBeforeAttributeUpdate = attributes => transformAttributes(this.mark.getAttributeTransforms(), attributes, this), this.graphicItem.setAttributes(this.graphicItem.attribute), this.clearGraphicAttributes(), this.mark.needAnimate() && (this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes(attributes), this.setFinalGraphicAttributes(attributes));
33728
+ this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey), this.graphicItem[BridgeElementKey] = this, this.graphicItem.onBeforeAttributeUpdate = attributes => {
33729
+ if (!this.mark) return attributes;
33730
+ return transformAttributes(this.mark.getAttributeTransforms(), attributes, this);
33731
+ }, this.graphicItem.setAttributes(this.graphicItem.attribute), this.clearGraphicAttributes(), this.mark.needAnimate() && (this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes(attributes), this.setFinalGraphicAttributes(attributes));
33705
33732
  }
33706
33733
  updateGraphicItem(config) {
33707
33734
  var _a;
@@ -33752,7 +33779,7 @@
33752
33779
  encodeGraphic() {
33753
33780
  this.coordinateTransformEncode(this.items);
33754
33781
  const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);
33755
- this.graphicItem ? this.applyGraphicAttributes(graphicAttributes) : this.initGraphicItem(graphicAttributes), this.diffState !== DiffState.enter && this.diffState !== DiffState.update || !this.states.length || (this.graphicItem.clearStates(), this.graphicItem.states = {}, this.useStates(this.states)), this.mark.markType === GrammarMarkType.shape && (this.graphicItem.datum = this.items[0].datum), this.items.forEach(item => {
33782
+ this.graphicItem ? (this.graphicItem.clearStates(), this.graphicItem.states = {}, this.graphicItem.stateProxy = null, this.applyGraphicAttributes(graphicAttributes)) : this.initGraphicItem(graphicAttributes), this.diffState !== DiffState.enter && this.diffState !== DiffState.update || !this.states.length || this.useStates(this.states), this.mark.markType === GrammarMarkType.shape && (this.graphicItem.datum = this.items[0].datum), this.items.forEach(item => {
33756
33783
  item.nextAttrs = {};
33757
33784
  }), this._setCutomizedShape();
33758
33785
  }
@@ -33823,7 +33850,7 @@
33823
33850
  const item = items[0];
33824
33851
  if (!item.nextAttrs || 0 === Object.keys(item.nextAttrs).length) return {};
33825
33852
  let nextAttrs = null == item ? void 0 : item.nextAttrs;
33826
- if (items && items.length && isNil(null === (_a = item.nextAttrs) || void 0 === _a ? void 0 : _a.points) && !1 !== computePoints && isPointsMarkType(markType)) {
33853
+ if (items && items.length && isNil(null === (_a = item.nextAttrs) || void 0 === _a ? void 0 : _a.points) && (!0 === computePoints || isValidPointsChannel(Object.keys(item.nextAttrs), this.mark.markType)) && isPointsMarkType(markType)) {
33827
33854
  const lastPoints = this.getGraphicAttribute("points", !1),
33828
33855
  lastSegments = this.getGraphicAttribute("segments", !1),
33829
33856
  enableSegments = null !== (_b = item.nextAttrs.enableSegments) && void 0 !== _b ? _b : this.getGraphicAttribute("enableSegments", !1),
@@ -33924,10 +33951,8 @@
33924
33951
  this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem = null);
33925
33952
  }
33926
33953
  release() {
33927
- var _a;
33928
- null === (_a = this.mark) || void 0 === _a || _a.animate.getElementAnimators(this).forEach(animator => {
33929
- animator.stop();
33930
- }), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
33954
+ var _a, _b;
33955
+ this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
33931
33956
  }
33932
33957
  getItemAttribute(channel) {
33933
33958
  var _a, _b;
@@ -36455,7 +36480,10 @@
36455
36480
  const glyphMarks = this.glyphMeta.getMarks();
36456
36481
  this.glyphGraphicItems = {}, this.graphicItem.getSubGraphic().forEach(graphic => {
36457
36482
  const markType = glyphMarks[graphic.name];
36458
- this.glyphGraphicItems[graphic.name] = graphic, graphic.onBeforeAttributeUpdate = attributes => transformAttributes(markType, attributes, this, graphic.name);
36483
+ this.glyphGraphicItems[graphic.name] = graphic, graphic.onBeforeAttributeUpdate = attributes => {
36484
+ if (!this.mark) return attributes;
36485
+ return transformAttributes(markType, attributes, this, graphic.name);
36486
+ };
36459
36487
  }), this.clearGraphicAttributes();
36460
36488
  }
36461
36489
  useStates(states, hasAnimation) {
@@ -36509,6 +36537,7 @@
36509
36537
  _onGlyphAttributeUpdate() {
36510
36538
  let first = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
36511
36539
  return attributes => {
36540
+ if (!this.mark) return attributes;
36512
36541
  const glyphMarks = this.glyphMeta.getMarks(),
36513
36542
  graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this),
36514
36543
  defaultEncodeValues = first ? this.encodeDefault() : null,
@@ -36730,7 +36759,7 @@
36730
36759
  constructor(view, markType, group) {
36731
36760
  super(view), this.grammarType = "mark", this.elements = [], this.elementMap = new Map(), this.isUpdated = !0, this.animate = new Animate(this, {}), this.differ = new Differ([]), this.evaluateSync = (data, parameters) => {
36732
36761
  var _a;
36733
- return this.evaluateMainTasks(data, parameters), (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.progressive) || this.evaluateTransformSync(this.transforms, this.elements, parameters), this;
36762
+ return this.evaluateMainTasks(data, parameters), (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.progressive) || this.evaluateTransformSync(this._getTransformsAfterEncode(), this.elements, parameters), this;
36734
36763
  }, this.markType = markType, this.spec.type = markType, this.spec.encode = {
36735
36764
  update: {}
36736
36765
  }, this.spec.group = group, group && (this.group = group, this.attach(group), group.appendChild(this));
@@ -36791,7 +36820,7 @@
36791
36820
  evaluate(data, parameters) {
36792
36821
  var _a;
36793
36822
  return __awaiter$7(this, void 0, void 0, function* () {
36794
- return this.evaluateMainTasks(data, parameters), (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.progressive) || (yield this.evaluateTransform(this.transforms, this.elements, parameters)), this;
36823
+ return this.evaluateMainTasks(data, parameters), (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.progressive) || (yield this.evaluateTransform(this._getTransformsAfterEncode(), this.elements, parameters)), this;
36795
36824
  });
36796
36825
  }
36797
36826
  output() {
@@ -37509,143 +37538,25 @@
37509
37538
  return "#" + rgbToHex(r, g, b);
37510
37539
  }
37511
37540
 
37512
- /**
37513
- * Common utilities
37514
- * @module glMatrix
37515
- */
37516
- var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
37517
- if (!Math.hypot) Math.hypot = function () {
37518
- var y = 0,
37519
- i = arguments.length;
37520
- while (i--) {
37521
- y += arguments[i] * arguments[i];
37522
- }
37523
- return Math.sqrt(y);
37524
- };
37525
-
37526
- /**
37527
- * 2 Dimensional Vector
37528
- * @module vec2
37529
- */
37530
-
37531
- /**
37532
- * Creates a new, empty vec2
37533
- *
37534
- * @returns {vec2} a new 2D vector
37535
- */
37536
-
37537
- function create$2() {
37538
- var out = new ARRAY_TYPE(2);
37539
- if (ARRAY_TYPE != Float32Array) {
37540
- out[0] = 0;
37541
- out[1] = 0;
37542
- }
37543
- return out;
37544
- }
37545
- /**
37546
- * Scales a vec2 by a scalar number
37547
- *
37548
- * @param {vec2} out the receiving vector
37549
- * @param {ReadonlyVec2} a the vector to scale
37550
- * @param {Number} b amount to scale the vector by
37551
- * @returns {vec2} out
37552
- */
37553
-
37554
- function scale(out, a, b) {
37555
- out[0] = a[0] * b;
37556
- out[1] = a[1] * b;
37557
- return out;
37541
+ function scale(vector, scale) {
37542
+ return [vector[0] * scale, vector[1] * scale];
37558
37543
  }
37559
- /**
37560
- * Calculates the length of a vec2
37561
- *
37562
- * @param {ReadonlyVec2} a vector to calculate length of
37563
- * @returns {Number} length of a
37564
- */
37565
-
37566
- function length(a) {
37567
- var x = a[0],
37568
- y = a[1];
37569
- return Math.hypot(x, y);
37544
+ function length(vector) {
37545
+ const [x, y] = vector;
37546
+ return Math.sqrt(x * x + y * y);
37570
37547
  }
37571
- /**
37572
- * Normalize a vec2
37573
- *
37574
- * @param {vec2} out the receiving vector
37575
- * @param {ReadonlyVec2} a vector to normalize
37576
- * @returns {vec2} out
37577
- */
37578
-
37579
- function normalize(out, a) {
37580
- var x = a[0],
37581
- y = a[1];
37582
- var len = x * x + y * y;
37583
- if (len > 0) {
37584
- //TODO: evaluate use of glm_invsqrt here?
37585
- len = 1 / Math.sqrt(len);
37586
- }
37587
- out[0] = a[0] * len;
37588
- out[1] = a[1] * len;
37589
- return out;
37548
+ function normalize(vector) {
37549
+ const [x, y] = vector;
37550
+ let len = x * x + y * y;
37551
+ return len > 0 && (len = 1 / Math.sqrt(len)), [vector[0] * len, vector[1] * len];
37590
37552
  }
37591
- /**
37592
- * Get the angle between two 2D vectors
37593
- * @param {ReadonlyVec2} a The first operand
37594
- * @param {ReadonlyVec2} b The second operand
37595
- * @returns {Number} The angle in radians
37596
- */
37597
-
37598
- function angle(a, b) {
37599
- var x1 = a[0],
37600
- y1 = a[1],
37601
- x2 = b[0],
37602
- y2 = b[1],
37603
- // mag is the product of the magnitudes of a and b
37604
- mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2),
37605
- // mag &&.. short circuits if mag == 0
37606
- cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1
37607
-
37553
+ function angle(vector1, vector2) {
37554
+ const [x1, y1] = vector1,
37555
+ [x2, y2] = vector2,
37556
+ mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2)),
37557
+ cosine = mag && (x1 * x2 + y1 * y2) / mag;
37608
37558
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
37609
37559
  }
37610
- /**
37611
- * Perform some operation over an array of vec2s.
37612
- *
37613
- * @param {Array} a the array of vectors to iterate over
37614
- * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
37615
- * @param {Number} offset Number of elements to skip at the beginning of the array
37616
- * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
37617
- * @param {Function} fn Function to call for each vector in the array
37618
- * @param {Object} [arg] additional argument to pass to fn
37619
- * @returns {Array} a
37620
- * @function
37621
- */
37622
-
37623
- (function () {
37624
- var vec = create$2();
37625
- return function (a, stride, offset, count, fn, arg) {
37626
- var i, l;
37627
- if (!stride) {
37628
- stride = 2;
37629
- }
37630
- if (!offset) {
37631
- offset = 0;
37632
- }
37633
- if (count) {
37634
- l = Math.min(count * stride + offset, a.length);
37635
- } else {
37636
- l = a.length;
37637
- }
37638
- for (i = offset; i < l; i += stride) {
37639
- vec[0] = a[i];
37640
- vec[1] = a[i + 1];
37641
- fn(vec, vec, arg);
37642
- a[i] = vec[0];
37643
- a[i + 1] = vec[1];
37644
- }
37645
- return a;
37646
- };
37647
- })();
37648
-
37649
37560
  function direction(v1, v2) {
37650
37561
  return v1[0] * v2[1] - v2[0] * v1[1];
37651
37562
  }
@@ -39190,11 +39101,10 @@
39190
39101
  axisTitle.name = AXIS_ELEMENT_NAME.title, axisTitle.id = this._getNodeId("title"), container.add(axisTitle);
39191
39102
  }
39192
39103
  renderGrid(container) {
39193
- this._renderGridByType("grid", container);
39194
39104
  const {
39195
39105
  visible: visible
39196
39106
  } = this.attribute.subGrid || {};
39197
- visible && this._renderGridByType("subGrid", container);
39107
+ visible && this._renderGridByType("subGrid", container), this._renderGridByType("grid", container);
39198
39108
  }
39199
39109
  getVerticalCoord(point, offset, inside) {
39200
39110
  const vector = this.getVerticalVector(offset, inside, point);
@@ -39429,9 +39339,9 @@
39429
39339
  verticalFactor = 1
39430
39340
  } = this.attribute,
39431
39341
  axisVector = this.getRelativeVector(),
39432
- normalize$1 = normalize([0, 0], axisVector),
39433
- verticalVector = [normalize$1[1], -1 * normalize$1[0]];
39434
- return scale([0, 0], verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
39342
+ normalizedAxisVector = normalize(axisVector),
39343
+ verticalVector = [normalizedAxisVector[1], -1 * normalizedAxisVector[0]];
39344
+ return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
39435
39345
  }
39436
39346
  getTitleAttribute() {
39437
39347
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -39673,7 +39583,7 @@
39673
39583
  center: center
39674
39584
  } = this.attribute,
39675
39585
  vector = [point.x - center.x, point.y - center.y];
39676
- return scale(vector, vector, (inside ? -1 : 1) * (axisInside ? -1 : 1) * offset / length(vector)), vector;
39586
+ return scale(vector, (inside ? -1 : 1) * (axisInside ? -1 : 1) * offset / length(vector));
39677
39587
  }
39678
39588
  getRelativeVector(point) {
39679
39589
  const {
@@ -41143,7 +41053,8 @@
41143
41053
  } = handler;
41144
41054
  preShape || (preShape = isHorizontal ? "triangleLeft" : "triangleUp"), nextShape || (nextShape = isHorizontal ? "triangleRight" : "triangleDown");
41145
41055
  const preHandler = createSymbol(Object.assign(Object.assign({
41146
- strokeBoundsBuffer: 0
41056
+ strokeBoundsBuffer: 0,
41057
+ pickMode: "imprecise"
41147
41058
  }, handlerStyle), {
41148
41059
  x: 0,
41149
41060
  y: 0,
@@ -41170,7 +41081,8 @@
41170
41081
  }, textStyle));
41171
41082
  this.text = text, container.add(text);
41172
41083
  const nextHandler = createSymbol(Object.assign(Object.assign({
41173
- strokeBoundsBuffer: 0
41084
+ strokeBoundsBuffer: 0,
41085
+ pickMode: "imprecise"
41174
41086
  }, handlerStyle), {
41175
41087
  x: isHorizontal ? handlerSizeX + 2 * handlerSpace + maxTextWidth : 0,
41176
41088
  y: isHorizontal ? 0 : handlerSizeY + 2 * handlerSpace + maxTextHeight,
@@ -41400,14 +41312,16 @@
41400
41312
  const itemGroup = this._renderEachItem(item, !!isEmpty(defaultSelected) || (null == defaultSelected ? void 0 : defaultSelected.includes(item.label)), index),
41401
41313
  itemWidth = itemGroup.attribute.width,
41402
41314
  itemHeight = itemGroup.attribute.height;
41403
- this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (maxPages = maxRow, isValid(maxWidth) && maxWidth < startX + itemWidth && (doWrap = !0, startX = 0, startY += itemHeight + spaceRow, pages += 1), index > 0 && itemGroup.setAttributes({
41315
+ this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (maxPages = maxRow, isValid(maxWidth) && (itemWidth >= maxWidth ? (doWrap = !0, index > 0 && (startX = 0, startY += itemHeight + spaceRow, pages += 1)) : maxWidth < startX + itemWidth && (doWrap = !0, startX = 0, startY += itemHeight + spaceRow, pages += 1)), index > 0 && itemGroup.setAttributes({
41404
41316
  x: startX,
41405
41317
  y: startY
41406
41318
  }), startX += spaceCol + itemWidth) : (maxPages = maxCol, isValid(maxHeight) && maxHeight < startY + itemHeight && (doWrap = !0, startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0, pages += 1), index > 0 && itemGroup.setAttributes({
41407
41319
  x: startX,
41408
41320
  y: startY
41409
41321
  }), startY += spaceRow + itemHeight), itemsContainer.add(itemGroup);
41410
- }), doWrap && autoPage && pages > maxPages ? this._renderPager(isHorizontal) : (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
41322
+ });
41323
+ let pagerRendered = !1;
41324
+ doWrap && autoPage && pages > maxPages && (pagerRendered = this._renderPager(isHorizontal)), pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
41411
41325
  }
41412
41326
  _bindEvents() {
41413
41327
  if (!this._itemsContainer) return;
@@ -41539,43 +41453,50 @@
41539
41453
  startX = 0,
41540
41454
  startY = 0,
41541
41455
  pages = 1;
41542
- isHorizontal ? (pagerComp = new Pager(Object.assign({
41543
- layout: 1 === maxRow ? "horizontal" : "vertical",
41544
- total: 99
41545
- }, merge$1({
41546
- handler: {
41547
- preShape: "triangleUp",
41548
- nextShape: "triangleDown"
41549
- }
41550
- }, pageStyle))), this._pager = pagerComp, this._innerView.add(pagerComp), pageHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, pageWidth = maxWidth - pagerComp.AABBBounds.width() - pagerSpace, itemsContainer.getChildren().forEach((item, index) => {
41551
- const {
41552
- width: width,
41553
- height: height
41554
- } = item.attribute;
41555
- pageWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
41556
- x: startX,
41557
- y: startY
41558
- }), startX += spaceCol + width;
41559
- }), pagerComp.setAttributes({
41560
- total: Math.ceil(pages / maxRow),
41561
- x: pageWidth,
41562
- y: renderStartY + pageHeight / 2 - pagerComp.AABBBounds.height() / 2
41563
- })) : (pagerComp = new Pager(Object.assign({
41564
- layout: "horizontal",
41565
- total: 99
41566
- }, pageStyle)), this._pager = pagerComp, this._innerView.add(pagerComp), pageWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, pageHeight = maxHeight - pagerComp.AABBBounds.height() - pagerSpace - renderStartY, itemsContainer.getChildren().forEach((item, index) => {
41567
- const {
41568
- height: height
41569
- } = item.attribute;
41570
- pageHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
41571
- x: startX,
41572
- y: startY
41573
- }), startY += spaceRow + height;
41574
- }), pagerComp.setAttributes({
41575
- total: Math.ceil(pages / maxCol),
41576
- x: (pageWidth - pagerComp.AABBBounds.width()) / 2,
41577
- y: maxHeight - pagerComp.AABBBounds.height()
41578
- })), pager.defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(pager.defaultCurrent - 1) * (pageHeight + spaceRow)) : itemsContainer.setAttribute("x", -(pager.defaultCurrent - 1) * (pageWidth + spaceCol)));
41456
+ if (isHorizontal) {
41457
+ if (pagerComp = new Pager(Object.assign({
41458
+ layout: 1 === maxRow ? "horizontal" : "vertical",
41459
+ total: 99
41460
+ }, merge$1({
41461
+ handler: {
41462
+ preShape: "triangleUp",
41463
+ nextShape: "triangleDown"
41464
+ }
41465
+ }, pageStyle))), this._pager = pagerComp, this._innerView.add(pagerComp), pageHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, pageWidth = maxWidth - pagerComp.AABBBounds.width() - pagerSpace, pageWidth <= 0) return this._innerView.removeChild(pagerComp), !1;
41466
+ itemsContainer.getChildren().forEach((item, index) => {
41467
+ const {
41468
+ width: width,
41469
+ height: height
41470
+ } = item.attribute;
41471
+ pageWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
41472
+ x: startX,
41473
+ y: startY
41474
+ }), startX += spaceCol + width;
41475
+ }), pagerComp.setAttributes({
41476
+ total: Math.ceil(pages / maxRow),
41477
+ x: pageWidth,
41478
+ y: renderStartY + pageHeight / 2 - pagerComp.AABBBounds.height() / 2
41479
+ });
41480
+ } else {
41481
+ if (pagerComp = new Pager(Object.assign({
41482
+ layout: "horizontal",
41483
+ total: 99
41484
+ }, pageStyle)), this._pager = pagerComp, this._innerView.add(pagerComp), pageWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, pageHeight = maxHeight - pagerComp.AABBBounds.height() - pagerSpace - renderStartY, pageHeight <= 0) return this._innerView.removeChild(pagerComp), !1;
41485
+ itemsContainer.getChildren().forEach((item, index) => {
41486
+ const {
41487
+ height: height
41488
+ } = item.attribute;
41489
+ pageHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
41490
+ x: startX,
41491
+ y: startY
41492
+ }), startY += spaceRow + height;
41493
+ }), pagerComp.setAttributes({
41494
+ total: Math.ceil(pages / maxCol),
41495
+ x: (pageWidth - pagerComp.AABBBounds.width()) / 2,
41496
+ y: maxHeight - pagerComp.AABBBounds.height()
41497
+ });
41498
+ }
41499
+ pager.defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(pager.defaultCurrent - 1) * (pageHeight + spaceRow)) : itemsContainer.setAttribute("x", -(pager.defaultCurrent - 1) * (pageWidth + spaceCol)));
41579
41500
  const clipGroup = createGroup({
41580
41501
  x: 0,
41581
41502
  y: renderStartY,
@@ -41595,7 +41516,7 @@
41595
41516
  x: -(current - 1) * (pageWidth + spaceCol)
41596
41517
  }, animationDuration, animationEasing) : isHorizontal ? itemsContainer.setAttribute("y", -(current - 1) * (pageHeight + spaceRow)) : itemsContainer.setAttribute("x", -(current - 1) * (pageWidth + spaceCol));
41597
41518
  };
41598
- this._pager.addEventListener("toPrev", onPaging), this._pager.addEventListener("toNext", onPaging);
41519
+ return this._pager.addEventListener("toPrev", onPaging), this._pager.addEventListener("toNext", onPaging), !0;
41599
41520
  }
41600
41521
  _setLegendItemState(legendItem, stateName) {
41601
41522
  let keepCurrentStates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
@@ -49236,8 +49157,14 @@
49236
49157
  static instanceExist(id) {
49237
49158
  return InstanceManager.instances.has(id);
49238
49159
  }
49239
- static forEach(callbackfn, thisArg) {
49240
- return InstanceManager.instances.forEach(callbackfn, thisArg);
49160
+ static forEach(callbackfn, excludeId = [], thisArg) {
49161
+ const excludeIdList = array(excludeId);
49162
+ return InstanceManager.instances.forEach((instance, id, map) => {
49163
+ if (excludeIdList.includes(id)) {
49164
+ return;
49165
+ }
49166
+ callbackfn(instance, id, map);
49167
+ }, thisArg);
49241
49168
  }
49242
49169
  }
49243
49170
 
@@ -49294,6 +49221,11 @@
49294
49221
  ...(option ?? {})
49295
49222
  }, textSpec);
49296
49223
  };
49224
+ const richText = createRichText({});
49225
+ function getRichTextBounds(params) {
49226
+ richText.setAttributes(params);
49227
+ return richText.AABBBounds;
49228
+ }
49297
49229
 
49298
49230
  function mergeFields(targetFields, mergeFields) {
49299
49231
  for (let i = 0; i < mergeFields.length; i++) {
@@ -49565,6 +49497,64 @@
49565
49497
  return data;
49566
49498
  };
49567
49499
 
49500
+ const DEFAULT_SMOOTH_INTERPOLATE = 'monotone';
49501
+ const DEFAULT_LINEAR_CLOSED_INTERPOLATE = 'linearClosed';
49502
+
49503
+ var ShapeTypeEnum;
49504
+ (function (ShapeTypeEnum) {
49505
+ ShapeTypeEnum["circle"] = "circle";
49506
+ ShapeTypeEnum["triangle"] = "triangle";
49507
+ ShapeTypeEnum["triangleUp"] = "triangleUp";
49508
+ ShapeTypeEnum["triangleLeft"] = "triangleLeft";
49509
+ ShapeTypeEnum["triangleRight"] = "triangleRight";
49510
+ ShapeTypeEnum["triangleDown"] = "triangleDown";
49511
+ ShapeTypeEnum["thinTriangle"] = "thinTriangle";
49512
+ ShapeTypeEnum["rect"] = "rect";
49513
+ ShapeTypeEnum["diamond"] = "diamond";
49514
+ ShapeTypeEnum["square"] = "square";
49515
+ ShapeTypeEnum["arrowLeft"] = "arrowLeft";
49516
+ ShapeTypeEnum["arrow2Left"] = "arrow2Left";
49517
+ ShapeTypeEnum["arrowRight"] = "arrowRight";
49518
+ ShapeTypeEnum["arrow2Right"] = "arrow2Right";
49519
+ ShapeTypeEnum["cross"] = "cross";
49520
+ ShapeTypeEnum["wedge"] = "wedge";
49521
+ ShapeTypeEnum["star"] = "star";
49522
+ ShapeTypeEnum["wye"] = "wye";
49523
+ })(ShapeTypeEnum || (ShapeTypeEnum = {}));
49524
+
49525
+ const DEFAULT_CLOSE_STROKE_JOIN = 'bevel';
49526
+
49527
+ var TooltipFixedPosition;
49528
+ (function (TooltipFixedPosition) {
49529
+ TooltipFixedPosition["top"] = "top";
49530
+ TooltipFixedPosition["left"] = "left";
49531
+ TooltipFixedPosition["right"] = "right";
49532
+ TooltipFixedPosition["bottom"] = "bottom";
49533
+ TooltipFixedPosition["inside"] = "inside";
49534
+ })(TooltipFixedPosition || (TooltipFixedPosition = {}));
49535
+
49536
+ function isXAxis(orient) {
49537
+ return orient === 'bottom' || orient === 'top';
49538
+ }
49539
+ function isYAxis(orient) {
49540
+ return orient === 'left' || orient === 'right';
49541
+ }
49542
+ function isZAxis(orient) {
49543
+ return orient === 'z';
49544
+ }
49545
+ function autoAxisType(orient, isHorizontal) {
49546
+ if (isHorizontal) {
49547
+ return isXAxis(orient) ? 'linear' : 'band';
49548
+ }
49549
+ return isXAxis(orient) ? 'band' : 'linear';
49550
+ }
49551
+ function getOrient(spec, whiteList) {
49552
+ return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
49553
+ }
49554
+ function getDirectionByOrient(orient) {
49555
+ return orient === 'top' || orient === 'bottom' ? Direction$2.horizontal : Direction$2.vertical;
49556
+ }
49557
+
49568
49558
  const getAxis$1 = (chart, type, pos) => {
49569
49559
  const axesComponents = chart
49570
49560
  .getAllComponents()
@@ -49592,6 +49582,8 @@
49592
49582
  }
49593
49583
  return null;
49594
49584
  };
49585
+ const XAxisGetDimensionField = (series) => series.fieldX[0];
49586
+ const YAxisGetDimensionField = (series) => series.fieldY[0];
49595
49587
  const getCartesianDimensionInfo = (chart, pos) => {
49596
49588
  if (!chart) {
49597
49589
  return null;
@@ -49605,49 +49597,15 @@
49605
49597
  const yAxisList = getAxis$1(chart, 'y', pos);
49606
49598
  const targetAxisInfo = [];
49607
49599
  if (xAxisList) {
49608
- const getDimensionField = (series) => series.fieldX[0];
49609
49600
  xAxisList.forEach(axis => {
49610
- const xScale = axis.getScale();
49611
- if (xScale && isDiscrete(xScale.type)) {
49612
- const xValue = x - axis.getLayoutStartPoint().x;
49613
- if ((xValue - xScale.range()[0]) * (xValue - xScale.range()[1]) > 0) {
49614
- return;
49615
- }
49616
- const value = xScale.invert(xValue);
49617
- if (isNil(value)) {
49618
- return;
49619
- }
49620
- const domain = xScale.domain();
49621
- let index = domain.findIndex((v) => v?.toString() === value.toString());
49622
- if (index < 0) {
49623
- index = undefined;
49624
- }
49625
- const data = getDimensionData(value, axis, 'cartesian', getDimensionField);
49626
- targetAxisInfo.push({ index, value, axis, data });
49627
- }
49601
+ const info = getDiscreteAxisDimensionInfo(axis, x, 'x', XAxisGetDimensionField);
49602
+ info && targetAxisInfo.push(info);
49628
49603
  });
49629
49604
  }
49630
49605
  if (yAxisList) {
49631
- const getDimensionField = (series) => series.fieldY[0];
49632
49606
  yAxisList.forEach(axis => {
49633
- const yScale = axis.getScale();
49634
- if (yScale && isDiscrete(yScale.type)) {
49635
- const yValue = y - axis.getLayoutStartPoint().y;
49636
- if ((yValue - yScale.range()[0]) * (yValue - yScale.range()[1]) > 0) {
49637
- return;
49638
- }
49639
- const value = yScale.invert(yValue);
49640
- if (isNil(value)) {
49641
- return;
49642
- }
49643
- const domain = yScale.domain();
49644
- let index = domain.findIndex((v) => v?.toString() === value.toString());
49645
- if (index < 0) {
49646
- index = undefined;
49647
- }
49648
- const data = getDimensionData(value, axis, 'cartesian', getDimensionField);
49649
- targetAxisInfo.push({ index, value, axis, data });
49650
- }
49607
+ const info = getDiscreteAxisDimensionInfo(axis, y, 'y', YAxisGetDimensionField);
49608
+ info && targetAxisInfo.push(info);
49651
49609
  });
49652
49610
  }
49653
49611
  if (!targetAxisInfo.length) {
@@ -49655,6 +49613,31 @@
49655
49613
  }
49656
49614
  return targetAxisInfo;
49657
49615
  };
49616
+ const getDiscreteAxisDimensionInfo = (axis, posValue, posKey, getDimensionField) => {
49617
+ const scale = axis.getScale();
49618
+ const scalePos = posValue - axis.getLayoutStartPoint()[posKey];
49619
+ if ((scalePos - scale.range()[0]) * (scalePos - scale.range()[1]) > 0) {
49620
+ return null;
49621
+ }
49622
+ const value = scale.invert(scalePos);
49623
+ return getDimensionInfoInAxis(axis, value, getDimensionField);
49624
+ };
49625
+ const getDimensionInfoInAxis = (axis, value, getDimensionField) => {
49626
+ const scale = axis.getScale();
49627
+ if (!scale || !isDiscrete(scale.type)) {
49628
+ return null;
49629
+ }
49630
+ if (isNil(value)) {
49631
+ return null;
49632
+ }
49633
+ const domain = scale.domain();
49634
+ let index = domain.findIndex((v) => v?.toString() === value.toString());
49635
+ if (index < 0) {
49636
+ index = undefined;
49637
+ }
49638
+ const data = getDimensionData(value, axis, 'cartesian', getDimensionField ?? (isXAxis(axis.orient) ? XAxisGetDimensionField : YAxisGetDimensionField));
49639
+ return { index, value, axis, data };
49640
+ };
49658
49641
 
49659
49642
  const getAxis = (chart, type, pos) => {
49660
49643
  const axesComponents = chart
@@ -49805,6 +49788,33 @@
49805
49788
  }
49806
49789
  return result;
49807
49790
  }
49791
+ dispatch(v, opt) {
49792
+ const axis = this._chart?.getAllComponents().filter(c => {
49793
+ if (c.specKey !== 'axes') {
49794
+ return false;
49795
+ }
49796
+ const scale = c.getScale();
49797
+ if (!isDiscrete(scale.type)) {
49798
+ return false;
49799
+ }
49800
+ if (opt?.filter) {
49801
+ return opt.filter(c);
49802
+ }
49803
+ return true;
49804
+ });
49805
+ const dimensionInfo = [];
49806
+ axis.forEach(a => {
49807
+ const info = getDimensionInfoInAxis(a, v);
49808
+ if (info) {
49809
+ dimensionInfo.push(info);
49810
+ }
49811
+ });
49812
+ this._callback.call(null, {
49813
+ action: 'enter',
49814
+ dimensionInfo
49815
+ });
49816
+ return dimensionInfo;
49817
+ }
49808
49818
  }
49809
49819
 
49810
49820
  class DimensionClickEvent extends DimensionEvent {
@@ -49925,6 +49935,9 @@
49925
49935
  _eventDispatcher;
49926
49936
  _mode;
49927
49937
  _composedEventMap = new Map();
49938
+ getComposedEventMap() {
49939
+ return this._composedEventMap;
49940
+ }
49928
49941
  constructor(eventDispatcher, mode) {
49929
49942
  this._eventDispatcher = eventDispatcher;
49930
49943
  this._mode = mode;
@@ -50903,11 +50916,14 @@
50903
50916
  static getMap(key) {
50904
50917
  return getMapSource(key);
50905
50918
  }
50906
- static hideTooltip() {
50907
- InstanceManager.forEach(instance => instance?.hideTooltip?.());
50919
+ static hideTooltip(excludeId = []) {
50920
+ InstanceManager.forEach(instance => instance?.hideTooltip?.(), excludeId);
50908
50921
  }
50909
50922
  static InstanceManager = InstanceManager;
50910
50923
  static ThemeManager = ThemeManager;
50924
+ static globalConfig = {
50925
+ uniqueTooltip: true
50926
+ };
50911
50927
  _spec;
50912
50928
  _viewBox;
50913
50929
  _chart;
@@ -51483,6 +51499,9 @@
51483
51499
  getComponents() {
51484
51500
  return this._chart.getAllComponents();
51485
51501
  }
51502
+ setDimensionIndex(value, opt = {}) {
51503
+ return this._chart?.setDimensionIndex(value, opt);
51504
+ }
51486
51505
  }
51487
51506
 
51488
51507
  var STATE_VALUE_ENUM;
@@ -51587,7 +51606,7 @@
51587
51606
  }
51588
51607
  constructor(option) {
51589
51608
  this._option = option;
51590
- this.event = new Event$1(option.eventDispatcher, option.mode);
51609
+ this.event = this._option.model.getOption().getChart().getEvent();
51591
51610
  this.interaction = option.interaction;
51592
51611
  this.initConfig(option.mode);
51593
51612
  }
@@ -51620,7 +51639,9 @@
51620
51639
  const items = [];
51621
51640
  params.dimensionInfo.forEach(df => {
51622
51641
  df.data.forEach(dd => {
51623
- const seriesMark = (reverse ? this._markReverse : this._marks).getMarks().filter(m => m.model === dd.series);
51642
+ const seriesMark = (reverse ? this._markReverse : this._marks)
51643
+ .getMarks()
51644
+ .filter(m => m.model === dd.series && m.getVisible());
51624
51645
  seriesMark.forEach(m => {
51625
51646
  const elements = m
51626
51647
  .getProduct()
@@ -54110,7 +54131,7 @@
54110
54131
  VChart.useMark([ComponentMark, GroupMark]);
54111
54132
  Factory.registerRegion('region', Region);
54112
54133
  Factory.registerLayout('base', Layout);
54113
- const version = "1.1.0-beta.3";
54134
+ const version = "1.1.0-beta.5";
54114
54135
 
54115
54136
  var SeriesMarkNameEnum;
54116
54137
  (function (SeriesMarkNameEnum) {
@@ -54598,6 +54619,9 @@
54598
54619
  _globalScale;
54599
54620
  _idMap = new Map();
54600
54621
  _event;
54622
+ getEvent() {
54623
+ return this._event;
54624
+ }
54601
54625
  _dataSet;
54602
54626
  _layoutTag = true;
54603
54627
  getLayoutTag() {
@@ -55479,6 +55503,51 @@
55479
55503
  }
55480
55504
  });
55481
55505
  }
55506
+ setDimensionIndex(value, opt) {
55507
+ let dimensionInfo = null;
55508
+ Array.from(this._event.getComposedEventMap().values()).forEach(e => {
55509
+ const { eventType, event } = e;
55510
+ if (eventType === DimensionEventEnum.dimensionHover || eventType === DimensionEventEnum.dimensionClick) {
55511
+ const info = event.dispatch(value, opt);
55512
+ if (info?.length) {
55513
+ dimensionInfo = info;
55514
+ }
55515
+ }
55516
+ });
55517
+ if (!dimensionInfo) {
55518
+ return;
55519
+ }
55520
+ if (opt.tooltip) {
55521
+ const tooltip = this._components.find(c => c.type === ComponentTypeEnum.tooltip);
55522
+ if (tooltip.getVisible()) {
55523
+ const dataFilter = {};
55524
+ dimensionInfo.forEach((d) => {
55525
+ const { axis, value, data } = d;
55526
+ const isY = axis.orient === 'left' || axis.orient === 'right';
55527
+ data.forEach(d => {
55528
+ if (isY) {
55529
+ dataFilter[d.series.fieldY[0]] = value;
55530
+ }
55531
+ else {
55532
+ dataFilter[d.series.fieldX[0]] = value;
55533
+ }
55534
+ });
55535
+ });
55536
+ tooltip.showTooltip(dataFilter, opt.showTooltipOption);
55537
+ }
55538
+ }
55539
+ if (opt.crosshair) {
55540
+ const crosshair = this._components.find(c => c.type === ComponentTypeEnum.cartesianCrosshair);
55541
+ if (crosshair && crosshair.clearAxisValue && crosshair.setAxisValue) {
55542
+ dimensionInfo.forEach((d) => {
55543
+ const { axis, value } = d;
55544
+ crosshair.clearAxisValue();
55545
+ crosshair.setAxisValue(value, axis);
55546
+ crosshair.layoutByValue();
55547
+ });
55548
+ }
55549
+ }
55550
+ }
55482
55551
  }
55483
55552
 
55484
55553
  class CartesianChart extends BaseChart {
@@ -55600,42 +55669,6 @@
55600
55669
  ChartTypeEnum["heatmap"] = "heatmap";
55601
55670
  })(ChartTypeEnum || (ChartTypeEnum = {}));
55602
55671
 
55603
- const DEFAULT_SMOOTH_INTERPOLATE = 'monotone';
55604
- const DEFAULT_LINEAR_CLOSED_INTERPOLATE = 'linearClosed';
55605
-
55606
- var ShapeTypeEnum;
55607
- (function (ShapeTypeEnum) {
55608
- ShapeTypeEnum["circle"] = "circle";
55609
- ShapeTypeEnum["triangle"] = "triangle";
55610
- ShapeTypeEnum["triangleUp"] = "triangleUp";
55611
- ShapeTypeEnum["triangleLeft"] = "triangleLeft";
55612
- ShapeTypeEnum["triangleRight"] = "triangleRight";
55613
- ShapeTypeEnum["triangleDown"] = "triangleDown";
55614
- ShapeTypeEnum["thinTriangle"] = "thinTriangle";
55615
- ShapeTypeEnum["rect"] = "rect";
55616
- ShapeTypeEnum["diamond"] = "diamond";
55617
- ShapeTypeEnum["square"] = "square";
55618
- ShapeTypeEnum["arrowLeft"] = "arrowLeft";
55619
- ShapeTypeEnum["arrow2Left"] = "arrow2Left";
55620
- ShapeTypeEnum["arrowRight"] = "arrowRight";
55621
- ShapeTypeEnum["arrow2Right"] = "arrow2Right";
55622
- ShapeTypeEnum["cross"] = "cross";
55623
- ShapeTypeEnum["wedge"] = "wedge";
55624
- ShapeTypeEnum["star"] = "star";
55625
- ShapeTypeEnum["wye"] = "wye";
55626
- })(ShapeTypeEnum || (ShapeTypeEnum = {}));
55627
-
55628
- const DEFAULT_CLOSE_STROKE_JOIN = 'bevel';
55629
-
55630
- var TooltipFixedPosition;
55631
- (function (TooltipFixedPosition) {
55632
- TooltipFixedPosition["top"] = "top";
55633
- TooltipFixedPosition["left"] = "left";
55634
- TooltipFixedPosition["right"] = "right";
55635
- TooltipFixedPosition["bottom"] = "bottom";
55636
- TooltipFixedPosition["inside"] = "inside";
55637
- })(TooltipFixedPosition || (TooltipFixedPosition = {}));
55638
-
55639
55672
  function setDefaultCrosshairForCartesianChart(spec) {
55640
55673
  spec.crosshair = array(spec.crosshair || {}).map(crosshairCfg => {
55641
55674
  return merge$1({
@@ -56426,6 +56459,10 @@
56426
56459
  itemMap: new Map()
56427
56460
  };
56428
56461
  tooltipHandler?.showTooltip?.(activeType, mockDimensionInfo, mockParams);
56462
+ const vchart = componentOptions.globalInstance;
56463
+ if (VChart.globalConfig.uniqueTooltip) {
56464
+ VChart.hideTooltip(vchart.id);
56465
+ }
56429
56466
  return activeType;
56430
56467
  }
56431
56468
  else if (activeType === 'mark') {
@@ -56453,6 +56490,10 @@
56453
56490
  series: info.series
56454
56491
  }
56455
56492
  ], mockParams);
56493
+ const vchart = componentOptions.globalInstance;
56494
+ if (VChart.globalConfig.uniqueTooltip) {
56495
+ VChart.hideTooltip(vchart.id);
56496
+ }
56456
56497
  return activeType;
56457
56498
  }
56458
56499
  return 'none';
@@ -65533,28 +65574,6 @@
65533
65574
  }
65534
65575
  mixin(RadarSeries, LineLikeSeriesMixin);
65535
65576
 
65536
- function isXAxis(orient) {
65537
- return orient === 'bottom' || orient === 'top';
65538
- }
65539
- function isYAxis(orient) {
65540
- return orient === 'left' || orient === 'right';
65541
- }
65542
- function isZAxis(orient) {
65543
- return orient === 'z';
65544
- }
65545
- function autoAxisType(orient, isHorizontal) {
65546
- if (isHorizontal) {
65547
- return isXAxis(orient) ? 'linear' : 'band';
65548
- }
65549
- return isXAxis(orient) ? 'band' : 'linear';
65550
- }
65551
- function getOrient(spec, whiteList) {
65552
- return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
65553
- }
65554
- function getDirectionByOrient(orient) {
65555
- return orient === 'top' || orient === 'bottom' ? Direction$2.horizontal : Direction$2.vertical;
65556
- }
65557
-
65558
65577
  class DotSeriesTooltipHelper extends BaseSeriesTooltipHelper {
65559
65578
  updateTooltipSpec() {
65560
65579
  super.updateTooltipSpec();
@@ -74027,7 +74046,7 @@
74027
74046
  outliersField: spec.outliersField,
74028
74047
  outliersStyle: spec.outliersStyle
74029
74048
  };
74030
- seriesSpec[spec.direction === Direction$2.vertical ? 'yField' : 'xField'] = dataFields;
74049
+ seriesSpec[seriesSpec.direction === Direction$2.vertical ? 'yField' : 'xField'] = dataFields;
74031
74050
  return seriesSpec;
74032
74051
  }
74033
74052
  transformSpec(spec) {
@@ -74042,19 +74061,6 @@
74042
74061
  }
74043
74062
  ];
74044
74063
  }
74045
- (spec.axes ?? []).forEach(axis => {
74046
- const { orient, type } = axis;
74047
- if (orient === 'left') {
74048
- if (isNil(type)) {
74049
- axis.type = spec.direction === Direction$2.vertical ? 'linear' : 'band';
74050
- }
74051
- }
74052
- if (orient === 'bottom') {
74053
- if (isNil(type)) {
74054
- axis.type = spec.direction === Direction$2.vertical ? 'band' : 'linear';
74055
- }
74056
- }
74057
- });
74058
74064
  setDefaultCrosshairForCartesianChart(spec);
74059
74065
  }
74060
74066
  }
@@ -78376,18 +78382,6 @@
78376
78382
  });
78377
78383
  }
78378
78384
  updateScaleDomain() {
78379
- if (!this.isSeriesDataEnable()) {
78380
- return;
78381
- }
78382
- this.computeStatisticsDomain();
78383
- for (let i = 0; i < this._scales.length; i++) {
78384
- const data = this.collectData(i);
78385
- const domain = this.computeDomain(data);
78386
- this._scales[i].domain(domain);
78387
- }
78388
- this.transformScaleDomain();
78389
- this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
78390
- this.event.emit(ChartEvent.scaleUpdate, { model: this });
78391
78385
  }
78392
78386
  computeData() {
78393
78387
  this._tickData.getDataView().reRunAllTransform();
@@ -79397,6 +79391,26 @@
79397
79391
  }
79398
79392
  return Array.from(tempSet);
79399
79393
  }
79394
+ updateScaleDomain() {
79395
+ if (!this.isSeriesDataEnable()) {
79396
+ return;
79397
+ }
79398
+ this.computeStatisticsDomain();
79399
+ const userDomain = this._spec.domain;
79400
+ for (let i = 0; i < this._scales.length; i++) {
79401
+ if (userDomain && userDomain.length && i === 0) {
79402
+ this._scales[i].domain(userDomain);
79403
+ }
79404
+ else {
79405
+ const data = this.collectData(i);
79406
+ const domain = this.computeDomain(data);
79407
+ this._scales[i].domain(domain);
79408
+ }
79409
+ }
79410
+ this.transformScaleDomain();
79411
+ this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
79412
+ this.event.emit(ChartEvent.scaleUpdate, { model: this });
79413
+ }
79400
79414
  }
79401
79415
 
79402
79416
  class CartesianBandAxis extends CartesianAxis {
@@ -80080,7 +80094,8 @@
80080
80094
  }
80081
80095
 
80082
80096
  const discreteLegendDataMake = (data, op) => {
80083
- const result = {};
80097
+ const result = [];
80098
+ const tempKey = {};
80084
80099
  const { series, seriesField } = op;
80085
80100
  series().forEach(s => {
80086
80101
  const field = seriesField(s);
@@ -80092,13 +80107,14 @@
80092
80107
  infoList = s.getSeriesInfoInField(field);
80093
80108
  }
80094
80109
  infoList.forEach(info => {
80095
- if (result[info.key]) {
80110
+ if (tempKey[info.key]) {
80096
80111
  return;
80097
80112
  }
80098
- result[info.key] = info;
80113
+ tempKey[info.key] = true;
80114
+ result.push(info);
80099
80115
  });
80100
80116
  });
80101
- return Object.values(result);
80117
+ return result;
80102
80118
  };
80103
80119
  const discreteLegendFilter = (data, op) => {
80104
80120
  const { selected, field, data: legendData } = op;
@@ -81839,6 +81855,24 @@
81839
81855
  }
81840
81856
  return value;
81841
81857
  }
81858
+ clearAxisValue() {
81859
+ this.currValueX.clear();
81860
+ this.currValueY.clear();
81861
+ }
81862
+ setAxisValue(v, axis) {
81863
+ if (isXAxis(axis.orient)) {
81864
+ this.currValueX.set(axis.getSpecIndex(), {
81865
+ v,
81866
+ axis
81867
+ });
81868
+ }
81869
+ else {
81870
+ this.currValueX.set(axis.getSpecIndex(), {
81871
+ v,
81872
+ axis
81873
+ });
81874
+ }
81875
+ }
81842
81876
  getAllAxisValues(axisMap, p, currValue, vertical) {
81843
81877
  let discrete = false;
81844
81878
  axisMap.forEach(item => {
@@ -81889,7 +81923,7 @@
81889
81923
  this._yLeftLabel && this._yLeftLabel.hideAll();
81890
81924
  this._yRightLabel && this._yRightLabel.hideAll();
81891
81925
  }
81892
- layoutByValue(tag) {
81926
+ layoutByValue(tag = LayoutType$1.ALL) {
81893
81927
  if (!this.enable) {
81894
81928
  return;
81895
81929
  }
@@ -83718,6 +83752,24 @@
83718
83752
  }
83719
83753
  }
83720
83754
 
83755
+ const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
83756
+ const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';
83757
+ const TOOLTIP_MAX_LINE_COUNT = 20;
83758
+ const TOOLTIP_EMPTY_STRING = '';
83759
+ const TOOLTIP_OTHERS_LINE = {
83760
+ key: '其他',
83761
+ value: '...'
83762
+ };
83763
+ const DEFAULT_OPTIONS = {
83764
+ offsetX: 10,
83765
+ offsetY: 10,
83766
+ sanitize: escapeHTML
83767
+ };
83768
+ class TooltipHandlerType {
83769
+ static dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
83770
+ static canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
83771
+ }
83772
+
83721
83773
  const getShowContent = (pattern, data, params) => {
83722
83774
  if (!data ||
83723
83775
  params?.event?.type === 'mouseout') {
@@ -84074,9 +84126,13 @@
84074
84126
  const { visible: titleVisible = true, value: titleValue = '', hasShape: titleHasShape, shapeType: titleShapeType = '', shapeHollow: titleShapeHollow, shapeColor: titleShapeColor } = title;
84075
84127
  attribute.title.visible = titleVisible;
84076
84128
  if (titleVisible) {
84077
- const { width, height } = initTextMeasure(titleStyle).quickMeasure(titleValue);
84129
+ const { text, width, height } = measureTooltipText(titleValue, titleStyle);
84078
84130
  attribute.title.value = {
84079
- text: titleValue
84131
+ width,
84132
+ height,
84133
+ text,
84134
+ multiLine: titleStyle.multiLine,
84135
+ wordBreak: titleStyle.wordBreak
84080
84136
  };
84081
84137
  maxWidth = width;
84082
84138
  titleMaxHeight = height;
@@ -84110,16 +84166,18 @@
84110
84166
  const keyWidths = [];
84111
84167
  const adaptiveKeyWidths = [];
84112
84168
  const valueWidths = [];
84113
- const keyTextMeasure = initTextMeasure(keyStyle);
84114
- const valueTextMeasure = initTextMeasure(valueStyle);
84115
84169
  attribute.content = filteredContent.map((item, i) => {
84116
84170
  const itemAttrs = { height: 0, spaceRow };
84117
84171
  let itemHeight = 0;
84118
84172
  const { hasShape, key, shapeColor, shapeHollow, shapeType = '', value, isKeyAdaptive } = item;
84119
84173
  if (isValid(key)) {
84120
- const { width, height } = keyTextMeasure.quickMeasure(key);
84174
+ const { width, height, text } = measureTooltipText(key, keyStyle);
84121
84175
  itemAttrs.key = {
84122
- text: key
84176
+ width,
84177
+ height,
84178
+ text,
84179
+ multiLine: keyStyle.multiLine,
84180
+ wordBreak: titleStyle.wordBreak
84123
84181
  };
84124
84182
  if (!isKeyAdaptive) {
84125
84183
  keyWidths.push(width);
@@ -84130,9 +84188,13 @@
84130
84188
  itemHeight = Math.max(itemHeight, height);
84131
84189
  }
84132
84190
  if (isValid(value)) {
84133
- const { width, height } = valueTextMeasure.quickMeasure(value);
84191
+ const { width, height, text } = measureTooltipText(value, valueStyle);
84134
84192
  itemAttrs.value = {
84135
- text: value
84193
+ width,
84194
+ height,
84195
+ text,
84196
+ multiLine: valueStyle.multiLine,
84197
+ wordBreak: titleStyle.wordBreak
84136
84198
  };
84137
84199
  valueWidths.push(width);
84138
84200
  itemHeight = Math.max(itemHeight, height);
@@ -84180,6 +84242,42 @@
84180
84242
  attribute.panel.height = containerSize.height;
84181
84243
  return attribute;
84182
84244
  };
84245
+ const measureTooltipText = (text, style) => {
84246
+ const measure = initTextMeasure(style);
84247
+ if (!style.multiLine) {
84248
+ const { width, height } = measure.fullMeasure(text);
84249
+ return {
84250
+ width,
84251
+ height,
84252
+ text
84253
+ };
84254
+ }
84255
+ let textLines = text.split('\n');
84256
+ textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\n' : line));
84257
+ const { width, height } = measure.fullMeasure(textLines);
84258
+ if (style.maxWidth && style.maxWidth <= width) {
84259
+ const bound = getRichTextBounds({
84260
+ wordBreak: style.wordBreak,
84261
+ maxWidth: style.maxWidth,
84262
+ width: 0,
84263
+ height: 0,
84264
+ textConfig: textLines.map((line, i) => ({
84265
+ ...style,
84266
+ text: line
84267
+ }))
84268
+ });
84269
+ return {
84270
+ width: bound.width(),
84271
+ height: bound.height(),
84272
+ text: textLines
84273
+ };
84274
+ }
84275
+ return {
84276
+ width,
84277
+ height,
84278
+ text: textLines
84279
+ };
84280
+ };
84183
84281
 
84184
84282
  function getTextAttributes(style = {}, globalTheme) {
84185
84283
  const attrs = {
@@ -84190,29 +84288,14 @@
84190
84288
  fontSize: style.fontSize,
84191
84289
  fontWeight: style.fontWeight,
84192
84290
  lineHeight: style.lineHeight,
84193
- spacing: style.spacing ?? 10
84291
+ spacing: style.spacing ?? 10,
84292
+ multiLine: style.multiLine ?? false,
84293
+ maxWidth: style.maxWidth,
84294
+ wordBreak: style.wordBreak ?? 'break-word'
84194
84295
  };
84195
84296
  return attrs;
84196
84297
  }
84197
84298
 
84198
- const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
84199
- const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';
84200
- const TOOLTIP_MAX_LINE_COUNT = 20;
84201
- const TOOLTIP_EMPTY_STRING = '';
84202
- const TOOLTIP_OTHERS_LINE = {
84203
- key: '其他',
84204
- value: '...'
84205
- };
84206
- const DEFAULT_OPTIONS = {
84207
- offsetX: 10,
84208
- offsetY: 10,
84209
- sanitize: escapeHTML
84210
- };
84211
- class TooltipHandlerType {
84212
- static dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
84213
- static canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
84214
- }
84215
-
84216
84299
  var TooltipResult;
84217
84300
  (function (TooltipResult) {
84218
84301
  TooltipResult[TooltipResult["success"] = 0] = "success";
@@ -84668,7 +84751,7 @@
84668
84751
  if (!labelStyle) {
84669
84752
  return undefined;
84670
84753
  }
84671
- const { fontFamily: labelFont, fontSize: labelFontSize, fill: labelColor, textAlign, lineHeight, fontWeight } = merge$1({}, defaultStyle, labelStyle);
84754
+ const { fontFamily: labelFont, fontSize: labelFontSize, fill: labelColor, textAlign, lineHeight, fontWeight, multiLine, wordBreak, maxWidth } = merge$1({}, defaultStyle, labelStyle);
84672
84755
  const styleObj = {};
84673
84756
  styleObj.fontFamily = labelFont;
84674
84757
  styleObj.fontSize = getPixelPropertyStr(labelFontSize);
@@ -84676,6 +84759,9 @@
84676
84759
  styleObj.textAlign = textAlign;
84677
84760
  styleObj.lineHeight = getPixelPropertyStr(lineHeight);
84678
84761
  styleObj.fontWeight = fontWeight;
84762
+ styleObj.whiteSpace = multiLine ? 'initial' : 'nowrap';
84763
+ styleObj.wordBreak = wordBreak;
84764
+ styleObj.maxWidth = getPixelPropertyStr(maxWidth);
84679
84765
  return styleObj;
84680
84766
  }
84681
84767
  function getShapeStyle(shapeStyle, defaultStyle) {
@@ -84685,11 +84771,9 @@
84685
84771
  const { size } = merge$1({}, defaultStyle, shapeStyle);
84686
84772
  const styleObj = {};
84687
84773
  styleObj.width = getPixelPropertyStr(size);
84688
- styleObj.height = styleObj.width;
84689
84774
  return styleObj;
84690
84775
  }
84691
84776
 
84692
- const domDocument = globalThis.document;
84693
84777
  class BaseTooltipModel {
84694
84778
  static type = 'tooltipModel';
84695
84779
  static isInstance(obj) {
@@ -84875,14 +84959,14 @@
84875
84959
  if (!option?.hasShape || !option.shapeType || !builtinSymbolsMap[option.shapeType]) {
84876
84960
  return '';
84877
84961
  }
84878
- const { shapeType, size, color, hollow = false } = option;
84962
+ const { shapeType, size, color, hollow = false, marginTop = '0px' } = option;
84879
84963
  const path = builtinSymbolsMap[shapeType].pathStr;
84880
84964
  let fill = 'currentColor';
84881
84965
  if (!color || isString(color) || hollow) {
84882
84966
  fill = hollow ? 'none' : color ?? 'currentColor';
84883
84967
  return `
84884
- <svg width="${size}"
84885
- height="${size}" viewBox="-0.5 -0.5 1 1" style="display: inline-block; vertical-align: middle;">
84968
+ <svg width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1"
84969
+ style="display: inline-block; vertical-align: middle; margin-top: ${marginTop};">
84886
84970
  <path fill="${fill}" d="${path}" style="fill: ${fill};">
84887
84971
  </path>
84888
84972
  </svg>`;
@@ -84905,8 +84989,8 @@
84905
84989
  `;
84906
84990
  }
84907
84991
  return `
84908
- <svg width="${size}" height="${size}"
84909
- viewBox="-0.5 -0.5 1 1" style="display: inline-block; vertical-align: middle;">
84992
+ <svg width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1"
84993
+ style="display: inline-block; vertical-align: middle; margin-top: ${marginTop};">
84910
84994
  ${gradient}
84911
84995
  <path fill="url(#${fill})" d="${path}" style="fill: url(#${fill});">
84912
84996
  </path>
@@ -84921,13 +85005,16 @@
84921
85005
  this.product = this.createElement(tag ?? 'span', classList, undefined, id);
84922
85006
  }
84923
85007
  }
84924
- setContent(content) {
85008
+ setContent(content, multiLine) {
84925
85009
  if (!this.product) {
84926
85010
  return;
84927
85011
  }
84928
- const html = this._option.valueToHtml(content);
85012
+ let html = this._option.valueToHtml(content);
85013
+ if (multiLine) {
85014
+ html = html.replaceAll('\n', '<br>');
85015
+ }
84929
85016
  if (html !== this.product.innerHTML) {
84930
- this.product.innerHTML = this._option.valueToHtml(content);
85017
+ this.product.innerHTML = html;
84931
85018
  }
84932
85019
  }
84933
85020
  }
@@ -84978,12 +85065,13 @@
84978
85065
  const tooltipStyle = this._option.getTooltipStyle();
84979
85066
  super.setStyle(merge$1({}, defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));
84980
85067
  const renderContent = this._option.getTooltipActual()?.content ?? [];
85068
+ const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];
84981
85069
  renderContent.forEach((line, i) => {
84982
85070
  let childStyle = {};
84983
85071
  if (this.className === 'key-box') {
84984
85072
  const { key, isKeyAdaptive } = line;
84985
85073
  childStyle = merge$1({}, isKeyAdaptive ? defaultAdaptiveKeyStyle : defaultKeyStyle, {
84986
- height: `${100 / renderContent.length}%`,
85074
+ height: getPixelPropertyStr(contentAttributes[i].height),
84987
85075
  ...tooltipStyle.keyColumn.item
84988
85076
  });
84989
85077
  const hasContent = (isString(key) && key?.trim?.() !== '') || isNumber(key);
@@ -84997,27 +85085,23 @@
84997
85085
  }
84998
85086
  else if (this.className === 'value-box') {
84999
85087
  childStyle = merge$1({}, defaultValueStyle, {
85000
- height: `${100 / renderContent.length}%`,
85088
+ height: getPixelPropertyStr(contentAttributes[i].height),
85001
85089
  ...tooltipStyle.valueColumn.item
85002
85090
  });
85003
85091
  this.children[i].setStyle(childStyle);
85004
85092
  }
85005
85093
  else if (this.className === 'shape-box') {
85006
- childStyle = merge$1({}, defaultShapeStyle, tooltipStyle.shapeColumn.item);
85007
- const childContent = {
85008
- hasShape: line.hasShape,
85009
- shapeType: line.shapeType,
85010
- size: tooltipStyle.shapeColumn.item?.width,
85011
- color: line.shapeColor,
85012
- hollow: line.shapeHollow
85013
- };
85014
- this.children[i]?.setStyle(childStyle, childContent);
85094
+ childStyle = merge$1({}, defaultShapeStyle, {
85095
+ height: getPixelPropertyStr(contentAttributes[i].height),
85096
+ ...tooltipStyle.shapeColumn.item
85097
+ });
85098
+ this.children[i]?.setStyle(childStyle, this._getShapeSvgOption(line));
85015
85099
  }
85016
85100
  });
85017
85101
  }
85018
85102
  setContent() {
85019
- const tooltipStyle = this._option.getTooltipStyle();
85020
85103
  const renderContent = this._option.getTooltipActual()?.content ?? [];
85104
+ const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];
85021
85105
  renderContent.forEach((line, i) => {
85022
85106
  let childContent;
85023
85107
  if (this.className === 'key-box') {
@@ -85028,6 +85112,7 @@
85028
85112
  else {
85029
85113
  childContent = TOOLTIP_EMPTY_STRING;
85030
85114
  }
85115
+ this.children[i]?.setContent(childContent, contentAttributes[i].value?.multiLine);
85031
85116
  }
85032
85117
  else if (this.className === 'value-box') {
85033
85118
  const valueContent = line.value;
@@ -85037,17 +85122,12 @@
85037
85122
  else {
85038
85123
  childContent = TOOLTIP_EMPTY_STRING;
85039
85124
  }
85125
+ this.children[i]?.setContent(childContent, contentAttributes[i].value?.multiLine);
85040
85126
  }
85041
85127
  else if (this.className === 'shape-box') {
85042
- childContent = {
85043
- hasShape: line.hasShape,
85044
- shapeType: line.shapeType,
85045
- size: tooltipStyle.shapeColumn.item?.width,
85046
- color: line.shapeColor,
85047
- hollow: line.shapeHollow
85048
- };
85128
+ childContent = this._getShapeSvgOption(line);
85129
+ this.children[i]?.setContent(childContent);
85049
85130
  }
85050
- this.children[i]?.setContent(childContent);
85051
85131
  });
85052
85132
  }
85053
85133
  _getContentColumnStyle() {
@@ -85067,6 +85147,17 @@
85067
85147
  return tooltipStyle.valueColumn;
85068
85148
  }
85069
85149
  }
85150
+ _getShapeSvgOption(line) {
85151
+ const tooltipStyle = this._option.getTooltipStyle();
85152
+ return {
85153
+ hasShape: line.hasShape,
85154
+ shapeType: line.shapeType,
85155
+ size: tooltipStyle.shapeColumn.item?.width,
85156
+ color: line.shapeColor,
85157
+ hollow: line.shapeHollow,
85158
+ marginTop: `calc((${tooltipStyle.keyColumn.item?.lineHeight ?? tooltipStyle.keyColumn.item?.fontSize ?? '18px'} - ${tooltipStyle.shapeColumn.item?.width ?? '8px'}) / 2)`
85159
+ };
85160
+ }
85070
85161
  }
85071
85162
 
85072
85163
  class ContentModel extends BaseTooltipModel {
@@ -85183,6 +85274,7 @@
85183
85274
  setContent() {
85184
85275
  const tooltipStyle = this._option.getTooltipStyle();
85185
85276
  const tooltipActual = this._option.getTooltipActual();
85277
+ const tooltipAttributes = this._option.getTooltipAttributes();
85186
85278
  const { title } = tooltipActual;
85187
85279
  this.init();
85188
85280
  this.shape?.setStyle(undefined, {
@@ -85192,7 +85284,7 @@
85192
85284
  color: title?.shapeColor,
85193
85285
  hollow: title?.shapeHollow
85194
85286
  });
85195
- this.textSpan?.setContent(title?.value);
85287
+ this.textSpan?.setContent(title?.value, tooltipAttributes.title?.value?.multiLine);
85196
85288
  }
85197
85289
  release() {
85198
85290
  super.release();
@@ -85323,7 +85415,7 @@
85323
85415
 
85324
85416
  class DomTooltipHandler extends BaseTooltipHandler {
85325
85417
  type = TooltipHandlerType.dom;
85326
- _tooltipContainer = globalThis.document?.body;
85418
+ _tooltipContainer = domDocument?.body;
85327
85419
  _domStyle;
85328
85420
  _tooltipActual;
85329
85421
  model;
@@ -85359,7 +85451,8 @@
85359
85451
  this.model = new TooltipModel(this._container, {
85360
85452
  valueToHtml: this._option.sanitize,
85361
85453
  getTooltipStyle: () => this._domStyle,
85362
- getTooltipActual: () => this._tooltipActual
85454
+ getTooltipActual: () => this._tooltipActual,
85455
+ getTooltipAttributes: () => this._attributeCache
85363
85456
  }, [tooltipSpec.className], this.id);
85364
85457
  }
85365
85458
  }
@@ -85796,6 +85889,10 @@
85796
85889
  this._cacheInfo = tooltipInfo;
85797
85890
  }
85798
85891
  }
85892
+ const vchart = this._option.globalInstance;
85893
+ if (success && VChart.globalConfig.uniqueTooltip) {
85894
+ VChart.hideTooltip(vchart.id);
85895
+ }
85799
85896
  return success;
85800
85897
  };
85801
85898
  _getMouseEventData = (params) => {
@@ -85859,7 +85956,7 @@
85859
85956
  this._spec.parentElement = userSpec.parentElement;
85860
85957
  }
85861
85958
  else if (isTrueBrowser(this._option.mode)) {
85862
- this._spec.parentElement = globalThis.document?.body;
85959
+ this._spec.parentElement = domDocument?.body;
85863
85960
  }
85864
85961
  if (isValid(userSpec.confine)) {
85865
85962
  this._spec.confine = userSpec.confine;
@@ -85953,6 +86050,9 @@
85953
86050
  }
85954
86051
  return false;
85955
86052
  }
86053
+ getVisible() {
86054
+ return this._spec.visible === true;
86055
+ }
85956
86056
  }
85957
86057
 
85958
86058
  function barLabel(labelInfo) {