@visactor/vchart 1.7.0 → 1.7.1

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 (61) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +169 -64
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base-chart.js +3 -4
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/chart/interface/chart.d.ts +7 -1
  8. package/cjs/chart/interface/chart.js.map +1 -1
  9. package/cjs/chart/interface/common.d.ts +1 -1
  10. package/cjs/chart/interface/common.js.map +1 -1
  11. package/cjs/chart/sequence/sequence.js +1 -2
  12. package/cjs/chart/sequence/sequence.js.map +1 -1
  13. package/cjs/component/axis/cartesian/axis.js +1 -2
  14. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  15. package/cjs/component/tooltip/handler/base.d.ts +15 -1
  16. package/cjs/component/tooltip/handler/base.js +84 -7
  17. package/cjs/component/tooltip/handler/base.js.map +1 -1
  18. package/cjs/component/tooltip/tooltip.js +5 -4
  19. package/cjs/component/tooltip/tooltip.js.map +1 -1
  20. package/cjs/core/index.d.ts +1 -1
  21. package/cjs/core/index.js +1 -1
  22. package/cjs/core/index.js.map +1 -1
  23. package/cjs/model/interface.d.ts +2 -1
  24. package/cjs/model/interface.js.map +1 -1
  25. package/cjs/series/base/base-series.js +8 -7
  26. package/cjs/series/base/base-series.js.map +1 -1
  27. package/cjs/series/pie/pie.d.ts +1 -0
  28. package/cjs/series/pie/pie.js +12 -0
  29. package/cjs/series/pie/pie.js.map +1 -1
  30. package/cjs/util/space.d.ts +1 -0
  31. package/cjs/util/space.js +10 -3
  32. package/cjs/util/space.js.map +1 -1
  33. package/esm/chart/base-chart.js +3 -4
  34. package/esm/chart/base-chart.js.map +1 -1
  35. package/esm/chart/interface/chart.d.ts +7 -1
  36. package/esm/chart/interface/chart.js.map +1 -1
  37. package/esm/chart/interface/common.d.ts +1 -1
  38. package/esm/chart/interface/common.js.map +1 -1
  39. package/esm/chart/sequence/sequence.js +1 -2
  40. package/esm/chart/sequence/sequence.js.map +1 -1
  41. package/esm/component/axis/cartesian/axis.js +1 -2
  42. package/esm/component/axis/cartesian/axis.js.map +1 -1
  43. package/esm/component/tooltip/handler/base.d.ts +15 -1
  44. package/esm/component/tooltip/handler/base.js +83 -6
  45. package/esm/component/tooltip/handler/base.js.map +1 -1
  46. package/esm/component/tooltip/tooltip.js +4 -4
  47. package/esm/component/tooltip/tooltip.js.map +1 -1
  48. package/esm/core/index.d.ts +1 -1
  49. package/esm/core/index.js +1 -1
  50. package/esm/core/index.js.map +1 -1
  51. package/esm/model/interface.d.ts +2 -1
  52. package/esm/model/interface.js.map +1 -1
  53. package/esm/series/base/base-series.js +8 -7
  54. package/esm/series/base/base-series.js.map +1 -1
  55. package/esm/series/pie/pie.d.ts +1 -0
  56. package/esm/series/pie/pie.js +12 -0
  57. package/esm/series/pie/pie.js.map +1 -1
  58. package/esm/util/space.d.ts +1 -0
  59. package/esm/util/space.js +7 -0
  60. package/esm/util/space.js.map +1 -1
  61. package/package.json +9 -9
package/build/index.js CHANGED
@@ -27528,6 +27528,20 @@
27528
27528
  const { x: x0, y: y0 } = point;
27529
27529
  return x0 < x + width && y0 < y + height && y0 > y && x0 > x;
27530
27530
  }
27531
+ function isPointInTriangle(point, v1, v2, v3) {
27532
+ const { x: x0, y: y0 } = point;
27533
+ const { x: x1, y: y1 } = v1;
27534
+ const { x: x2, y: y2 } = v2;
27535
+ const { x: x3, y: y3 } = v3;
27536
+ const divisor = (y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3);
27537
+ if (!divisor) {
27538
+ return false;
27539
+ }
27540
+ const a = ((y2 - y3) * (x0 - x3) + (x3 - x2) * (y0 - y3)) / divisor;
27541
+ const b = ((y3 - y1) * (x0 - x3) + (x1 - x3) * (y0 - y3)) / divisor;
27542
+ const c = 1 - a - b;
27543
+ return a >= 0 && a <= 1 && b >= 0 && b <= 1 && c >= 0 && c <= 1;
27544
+ }
27531
27545
  function isPercent(v) {
27532
27546
  if (!isString$1(v)) {
27533
27547
  return false;
@@ -28767,30 +28781,6 @@
28767
28781
  }), graphicAttributes[name] = storedAttrs, storedAttrs;
28768
28782
  }
28769
28783
  const transformsByType = {
28770
- [GrammarMarkType.largeRects]: [{
28771
- channels: ["x", "y", "y1", "x1", "width", "height"],
28772
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28773
- graphicAttributes.x = 0, graphicAttributes.y = 0;
28774
- }
28775
- }],
28776
- [GrammarMarkType.largeSymbols]: [{
28777
- channels: ["x", "y", "size"],
28778
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28779
- graphicAttributes.x = 0, graphicAttributes.y = 0;
28780
- }
28781
- }],
28782
- [GrammarMarkType.area]: [{
28783
- channels: ["x", "y", "x1", "y1"],
28784
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28785
- graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
28786
- }
28787
- }],
28788
- [GrammarMarkType.line]: [{
28789
- channels: ["x", "y", "defined"],
28790
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28791
- graphicAttributes.x = 0, graphicAttributes.y = 0;
28792
- }
28793
- }],
28794
28784
  [GrammarMarkType.rect]: [{
28795
28785
  channels: ["x", "y", "x1", "y1", "width", "height"],
28796
28786
  transform: (graphicAttributes, nextAttrs, storedAttrs) => {
@@ -28921,13 +28911,19 @@
28921
28911
  startIndex: index
28922
28912
  }));
28923
28913
  }), segments.length >= 2 ? segments.map(entry => {
28924
- const res = transformAttributes(GrammarMarkType.line, entry.attrs, element);
28914
+ const res = transformAttributes(GrammarMarkType.line, parseCollectionMarkAttributes(entry.attrs), element);
28925
28915
  return res.points = points.slice(entry.startIndex, isNil$1(entry.endIndex) ? points.length : entry.endIndex), res;
28926
28916
  }) : null;
28927
28917
  }
28928
28918
  function getLinePointsFromSegments(segments) {
28929
28919
  return segments ? segments.reduce((points, segment) => points.concat(segment.points), []) : null;
28930
28920
  }
28921
+ function parseCollectionMarkAttributes(itemNextAttrs) {
28922
+ const result = {};
28923
+ return itemNextAttrs ? (Object.keys(itemNextAttrs).forEach(key => {
28924
+ "x" !== key && "y" !== key && "x1" !== key && "y1" !== key && "defined" !== key && "size" !== key && "width" !== key && "height" !== key && "context" !== key && (result[key] = itemNextAttrs[key]);
28925
+ }), result) : result;
28926
+ }
28931
28927
 
28932
28928
  let Element$1 = class Element {
28933
28929
  constructor(mark) {
@@ -29094,7 +29090,7 @@
29094
29090
  enableSegments = this.mark.getSpec().enableSegments,
29095
29091
  itemNextAttrs = items.map(item => item.nextAttrs),
29096
29092
  isProgressive = this.mark.isProgressive();
29097
- if (nextAttrs = Object.assign({}, nextAttrs), delete nextAttrs.x, delete nextAttrs.y, markType === GrammarMarkType.line || markType === GrammarMarkType.area) {
29093
+ if (nextAttrs = parseCollectionMarkAttributes(nextAttrs), markType === GrammarMarkType.line || markType === GrammarMarkType.area) {
29098
29094
  const linePoints = getLinePoints(items, !0, lastPoints, markType === GrammarMarkType.area);
29099
29095
  if (enableSegments && !isProgressive) {
29100
29096
  const points = linePoints && 0 !== linePoints.length ? linePoints : getLinePointsFromSegments(lastSegments),
@@ -58630,7 +58626,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58630
58626
  };
58631
58627
  registerVChartCore();
58632
58628
 
58633
- const version = "1.7.0";
58629
+ const version = "1.7.1";
58634
58630
 
58635
58631
  class ChartData {
58636
58632
  get dataList() {
@@ -59224,7 +59220,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59224
59220
  this._event = new Event$1(option.eventDispatcher, option.mode);
59225
59221
  this._dataSet = option.dataSet;
59226
59222
  this._chartData = new ChartData(this._dataSet, (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError);
59227
- this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError });
59223
+ this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError, getSeriesData: this._chartData.getSeriesData.bind(this._chartData) });
59228
59224
  this._spec = spec;
59229
59225
  }
59230
59226
  created() {
@@ -59303,9 +59299,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59303
59299
  }
59304
59300
  _createSeries(seriesSpec) {
59305
59301
  seriesSpec.forEach((spec, index) => {
59306
- if (!spec.data) {
59307
- spec.data = this._chartData.getSeriesData(spec.dataId, spec.dataIndex);
59308
- }
59309
59302
  if (this._option.animation === false) {
59310
59303
  spec.animation = false;
59311
59304
  }
@@ -59322,7 +59315,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59322
59315
  if (!region) {
59323
59316
  return;
59324
59317
  }
59325
- const series = Factory.createSeries(spec.type, spec, Object.assign(Object.assign({}, this._modelOption), { region, specIndex: index, globalScale: this._globalScale, getSeriesData: this._chartData.getSeriesData.bind(this._chartData), sourceDataList: this._chartData.dataList }));
59318
+ const series = Factory.createSeries(spec.type, spec, Object.assign(Object.assign({}, this._modelOption), { region, specIndex: index, globalScale: this._globalScale, sourceDataList: this._chartData.dataList }));
59326
59319
  if (series) {
59327
59320
  series.created();
59328
59321
  this._series.push(series);
@@ -61090,13 +61083,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61090
61083
  }
61091
61084
  }
61092
61085
  initData() {
61093
- var _a, _b, _c, _d;
61094
- if (this._spec.data) {
61095
- this._rawData = dataToDataView(this._spec.data, this._dataSet, this._option.sourceDataList, {
61096
- onError: (_a = this._option) === null || _a === void 0 ? void 0 : _a.onError
61086
+ var _a, _b, _c, _d, _e;
61087
+ const d = (_a = this._spec.data) !== null && _a !== void 0 ? _a : this._option.getSeriesData(this._spec.dataId, this._spec.dataIndex);
61088
+ if (d) {
61089
+ this._rawData = dataToDataView(d, this._dataSet, this._option.sourceDataList, {
61090
+ onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError
61097
61091
  });
61098
61092
  }
61099
- (_b = this._rawData) === null || _b === void 0 ? void 0 : _b.target.addListener('change', this.rawDataUpdate.bind(this));
61093
+ (_c = this._rawData) === null || _c === void 0 ? void 0 : _c.target.addListener('change', this.rawDataUpdate.bind(this));
61100
61094
  this._addDataIndexAndKey();
61101
61095
  if (this._rawData) {
61102
61096
  if (this._stack) {
@@ -61112,9 +61106,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61112
61106
  this._viewDataFilter.target.removeListener('change', viewData.reRunAllTransform);
61113
61107
  }
61114
61108
  }
61115
- if (this._invalidType === 'zero' && ((_c = this._rawData) === null || _c === void 0 ? void 0 : _c.dataSet)) {
61109
+ if (this._invalidType === 'zero' && ((_d = this._rawData) === null || _d === void 0 ? void 0 : _d.dataSet)) {
61116
61110
  registerDataSetInstanceTransform(this._rawData.dataSet, 'invalidTravel', invalidTravel);
61117
- (_d = this._rawData) === null || _d === void 0 ? void 0 : _d.transform({
61111
+ (_e = this._rawData) === null || _e === void 0 ? void 0 : _e.transform({
61118
61112
  type: 'invalidTravel',
61119
61113
  options: {
61120
61114
  config: () => {
@@ -61360,7 +61354,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61360
61354
  });
61361
61355
  }
61362
61356
  else if (!parentMark && (!isNil$1(spec.dataId) || !isNil$1(spec.dataIndex))) {
61363
- const dataView = this._option.getSeriesData(spec.id, spec.dataIndex);
61357
+ const dataView = this._option.getSeriesData(spec.dataId, spec.dataIndex);
61364
61358
  if (dataView === this._rawData) {
61365
61359
  mark.setDataView(this.getViewData(), this.getViewDataProductId());
61366
61360
  }
@@ -66323,6 +66317,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66323
66317
  y: (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.centerY) !== null && _d !== void 0 ? _d : this._region.getLayoutRect().height / 2
66324
66318
  };
66325
66319
  }
66320
+ _buildMarkAttributeContext() {
66321
+ super._buildMarkAttributeContext();
66322
+ this._markAttributeContext.getCenter = () => {
66323
+ return {
66324
+ x: () => { var _a, _b; return (_b = (_a = this._center) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : this._region.getLayoutRect().width / 2; },
66325
+ y: () => { var _a, _b; return (_b = (_a = this._center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : this._region.getLayoutRect().height / 2; }
66326
+ };
66327
+ };
66328
+ }
66326
66329
  setAttrFromSpec() {
66327
66330
  var _a, _b, _c, _d, _e, _f, _g;
66328
66331
  super.setAttrFromSpec();
@@ -68538,9 +68541,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
68538
68541
  }
68539
68542
  _createSeries(seriesSpec) {
68540
68543
  seriesSpec.forEach((spec, index) => {
68541
- if (!spec.data) {
68542
- spec.data = this._chartData.getSeriesData(spec.dataId, spec.dataIndex);
68543
- }
68544
68544
  if (spec.type === exports.SeriesTypeEnum.link) {
68545
68545
  spec.dotSeriesSpec = this._spec.series[spec.dotSeriesIndex];
68546
68546
  }
@@ -77592,10 +77592,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77592
77592
  nodeMap: nodeMap
77593
77593
  };
77594
77594
  }
77595
- computeNodeLinks(data) {
77596
- if (!("links" in data)) return this._isHierarchic = !0, this.computeHierarchicNodeLinks(data.nodes);
77597
- let nodes = [];
77598
- const links = [],
77595
+ computeSourceTargetNodeLinks(data) {
77596
+ const nodes = [],
77597
+ links = [],
77599
77598
  nodeMap = {};
77600
77599
  data.nodes && data.nodes.forEach((node, index) => {
77601
77600
  const nodeElement = {
@@ -77610,7 +77609,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77610
77609
  nodeMap[nodeElement.key] = nodeElement, nodes.push(nodeElement);
77611
77610
  });
77612
77611
  const invalidLinks = [];
77613
- if (data.links.forEach((link, index) => {
77612
+ return data.links.forEach((link, index) => {
77614
77613
  if (isNil$1(link.source) || isNil$1(link.target)) return;
77615
77614
  if (data.nodes && (!nodeMap[link.source] || !nodeMap[link.target])) return;
77616
77615
  data.nodes || nodeMap[link.source] || (nodeMap[link.source] = {
@@ -77641,11 +77640,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77641
77640
  }), this.options.divideNodeValueToLink && invalidLinks.length && invalidLinks.forEach(link => {
77642
77641
  const values = [calcDivideValue(nodeMap[link.source]), calcDivideValue(nodeMap[link.target], !0)].filter(entry => !isNil$1(entry));
77643
77642
  values.length && (link.value = minInArray(values));
77644
- }), this.options.linkSortBy) for (let i = 0, len = nodes.length; i < len; i++) nodes[i].sourceLinks.sort(this.options.linkSortBy), nodes[i].targetLinks.sort(this.options.linkSortBy);
77643
+ }), {
77644
+ nodeMap: nodeMap,
77645
+ nodes: nodes,
77646
+ links: links
77647
+ };
77648
+ }
77649
+ computeNodeLinks(data) {
77650
+ let res;
77651
+ "links" in data ? res = this.computeSourceTargetNodeLinks(data) : (this._isHierarchic = !0, res = this.computeHierarchicNodeLinks(data.nodes));
77652
+ let nodes = res.nodes;
77653
+ const links = res.links;
77654
+ if (this.options.linkSortBy) for (let i = 0, len = nodes.length; i < len; i++) nodes[i].sourceLinks.sort(this.options.linkSortBy), nodes[i].targetLinks.sort(this.options.linkSortBy);
77645
77655
  return this.options.dropIsolatedNode && (nodes = nodes.filter(node => node.targetLinks.length || node.sourceLinks.length)), {
77646
77656
  nodes: nodes,
77647
77657
  links: links,
77648
- nodeMap: nodeMap
77658
+ nodeMap: res.nodeMap
77649
77659
  };
77650
77660
  }
77651
77661
  computeNodeValues(nodes) {
@@ -81277,10 +81287,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81277
81287
  const axisComponent = product.getGroupGraphicItem();
81278
81288
  const spec = mergeSpec(Object.assign({}, this.getLayoutStartPoint()), this._axisStyle, attrs, { line: { visible: false } });
81279
81289
  const updateBounds = axisComponent.getBoundsWithoutRender(spec);
81290
+ hasBounds = true;
81291
+ this._latestBounds = updateBounds;
81280
81292
  if (isFinite(updateBounds.width())) {
81281
81293
  result = this._appendAxisUnit(updateBounds, isX);
81282
- hasBounds = true;
81283
- this._latestBounds = updateBounds;
81284
81294
  }
81285
81295
  }
81286
81296
  if (!hasBounds) {
@@ -84030,8 +84040,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84030
84040
  let changePositionOnly = !!params.changePositionOnly;
84031
84041
  if (!params.changePositionOnly || ((_a = this._cacheActualTooltip) === null || _a === void 0 ? void 0 : _a.activeType) !== activeType) {
84032
84042
  changePositionOnly = false;
84033
- this._cacheViewSpec = undefined;
84034
- this._cacheActualTooltip = undefined;
84043
+ this._clearCacheOfContent();
84035
84044
  }
84036
84045
  if (changePositionOnly && this._cacheViewSpec && this._cacheActualTooltip) {
84037
84046
  return this.changeTooltipPosition(changePositionOnly, data, params);
@@ -84045,8 +84054,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84045
84054
  return TooltipResult.failed;
84046
84055
  }
84047
84056
  if (!visible) {
84048
- this._cacheViewSpec = undefined;
84049
- this._cacheActualTooltip = undefined;
84057
+ this._clearAllCache();
84050
84058
  if (tooltipSpec.handler) {
84051
84059
  return (_c = (_b = (_a = tooltipSpec.handler).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : TooltipResult.success;
84052
84060
  }
@@ -84100,6 +84108,21 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84100
84108
  if (!spec || !actualTooltip) {
84101
84109
  return TooltipResult.failed;
84102
84110
  }
84111
+ if (spec.enterable) {
84112
+ if (!this._isPointerEscaped && this._isPointerMovingToTooltip(params)) {
84113
+ if (!this._isTooltipPaused) {
84114
+ this._isTooltipPaused = true;
84115
+ this._cachePointerTimer = setTimeout(() => {
84116
+ this._isPointerEscaped = true;
84117
+ }, 300);
84118
+ }
84119
+ return TooltipResult.success;
84120
+ }
84121
+ this._isTooltipPaused = false;
84122
+ this._isPointerEscaped = false;
84123
+ clearTimeout(this._cachePointerTimer);
84124
+ this._cachePointerPosition = this._getPointerPositionRelativeToTooltipParent(params);
84125
+ }
84103
84126
  const activeType = actualTooltip.activeType;
84104
84127
  if (spec.handler) {
84105
84128
  return (_c = (_b = (_a = spec.handler).showTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, activeType, data, params)) !== null && _c !== void 0 ? _c : TooltipResult.success;
@@ -84140,6 +84163,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84140
84163
  const { offsetX, offsetY } = this._option;
84141
84164
  const tooltipSpec = this._cacheViewSpec;
84142
84165
  if (!tooltipSpec) {
84166
+ this._cacheTooltipPosition = undefined;
84143
84167
  return invalidPosition;
84144
84168
  }
84145
84169
  const { activeType, data } = actualTooltip;
@@ -84406,7 +84430,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84406
84430
  detectTopLast();
84407
84431
  break;
84408
84432
  }
84409
- return { x, y };
84433
+ const result = { x, y };
84434
+ this._cacheTooltipPosition = result;
84435
+ this._cacheTooltipSize = { width: tooltipBoxWidth, height: tooltipBoxHeight };
84436
+ return result;
84410
84437
  };
84411
84438
  this._component = component;
84412
84439
  this._chartOption = component.getOption();
@@ -84421,8 +84448,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84421
84448
  }
84422
84449
  release() {
84423
84450
  var _a, _b, _c;
84424
- this._cacheViewSpec = undefined;
84425
- this._cacheActualTooltip = undefined;
84451
+ this._clearAllCache();
84426
84452
  const spec = (_a = this._component.getSpec()) !== null && _a !== void 0 ? _a : {};
84427
84453
  if (spec.handler) {
84428
84454
  (_c = (_b = spec.handler).release) === null || _c === void 0 ? void 0 : _c.call(_b);
@@ -84431,6 +84457,23 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84431
84457
  this._removeTooltip();
84432
84458
  this._isReleased = true;
84433
84459
  }
84460
+ _clearAllCache() {
84461
+ this._clearCacheOfContent();
84462
+ this._clearCacheOfPosition();
84463
+ }
84464
+ _clearCacheOfContent() {
84465
+ this._cacheViewSpec = undefined;
84466
+ this._cacheActualTooltip = undefined;
84467
+ }
84468
+ _clearCacheOfPosition() {
84469
+ this._isTooltipPaused = false;
84470
+ this._isPointerEscaped = false;
84471
+ clearTimeout(this._cachePointerTimer);
84472
+ this._cachePointerTimer = -1;
84473
+ this._cachePointerPosition = undefined;
84474
+ this._cacheTooltipPosition = undefined;
84475
+ this._cacheTooltipSize = undefined;
84476
+ }
84434
84477
  _throttle(callback) {
84435
84478
  const tooltipSpec = this._component.getSpec();
84436
84479
  let wait;
@@ -84463,6 +84506,68 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84463
84506
  height: (_f = (_e = this._attributes) === null || _e === void 0 ? void 0 : _e.panel) === null || _f === void 0 ? void 0 : _f.height
84464
84507
  };
84465
84508
  }
84509
+ _getPointerPositionRelativeToTooltipParent(params) {
84510
+ var _a, _b;
84511
+ let { canvasX: x, canvasY: y } = params.event;
84512
+ const invalidPosition = {
84513
+ x: Infinity,
84514
+ y: Infinity
84515
+ };
84516
+ const tooltipSpec = this._cacheViewSpec;
84517
+ const isCanvas = tooltipSpec.renderMode === 'canvas';
84518
+ const tooltipParentElement = this._getParentElement(tooltipSpec);
84519
+ let relativePosOffset = { x: 0, y: 0 };
84520
+ let tooltipParentElementRect = { x: 0, y: 0 };
84521
+ let chartElementScale = 1;
84522
+ let tooltipParentElementScale = 1;
84523
+ if (isTrueBrowser(this._env) && !tooltipSpec.confine) {
84524
+ if (!isCanvas) {
84525
+ tooltipParentElementRect = (_a = tooltipParentElement === null || tooltipParentElement === void 0 ? void 0 : tooltipParentElement.getBoundingClientRect()) !== null && _a !== void 0 ? _a : invalidPosition;
84526
+ const chartElement = ((_b = this._compiler.getCanvas()) !== null && _b !== void 0 ? _b : this._chartContainer);
84527
+ const chartElementRect = chartElement === null || chartElement === void 0 ? void 0 : chartElement.getBoundingClientRect();
84528
+ relativePosOffset = {
84529
+ x: chartElementRect.x - tooltipParentElementRect.x,
84530
+ y: chartElementRect.y - tooltipParentElementRect.y
84531
+ };
84532
+ chartElementScale = getScale(chartElement, chartElementRect);
84533
+ tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect);
84534
+ }
84535
+ }
84536
+ x *= chartElementScale;
84537
+ y *= chartElementScale;
84538
+ if (isTrueBrowser(this._env)) {
84539
+ x += relativePosOffset.x;
84540
+ y += relativePosOffset.y;
84541
+ }
84542
+ x /= tooltipParentElementScale;
84543
+ y /= tooltipParentElementScale;
84544
+ return { x, y };
84545
+ }
84546
+ _isPointerMovingToTooltip(params) {
84547
+ if (!this._cacheTooltipPosition || !this._cacheTooltipSize || !this._cachePointerPosition) {
84548
+ return false;
84549
+ }
84550
+ const { width: tooltipWidth, height: tooltipHeight } = this._cacheTooltipSize;
84551
+ const { x: tooltipX = 0, y: tooltipY } = this._cacheTooltipPosition;
84552
+ const pos = this._getPointerPositionRelativeToTooltipParent(params);
84553
+ if (isPointInRect(pos, {
84554
+ x: tooltipX,
84555
+ y: tooltipY,
84556
+ width: tooltipWidth,
84557
+ height: tooltipHeight
84558
+ })) {
84559
+ return true;
84560
+ }
84561
+ const a = { x: tooltipX, y: tooltipY };
84562
+ const b = { x: a.x + tooltipWidth, y: a.y };
84563
+ const c = { x: a.x, y: a.y + tooltipHeight };
84564
+ const d = { x: b.x, y: c.y };
84565
+ const oldPos = this._cachePointerPosition;
84566
+ return (isPointInTriangle(pos, oldPos, a, b) ||
84567
+ isPointInTriangle(pos, oldPos, c, d) ||
84568
+ isPointInTriangle(pos, oldPos, a, d) ||
84569
+ isPointInTriangle(pos, oldPos, b, c));
84570
+ }
84466
84571
  _getParentElement(spec) {
84467
84572
  return spec.parentElement;
84468
84573
  }
@@ -86238,19 +86343,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86238
86343
  var _a, _b;
86239
86344
  if (this._spec.enterable && this._spec.renderMode === 'html') {
86240
86345
  const { event } = params;
86241
- let target;
86346
+ let newTarget;
86242
86347
  if (isValid$1(event.nativeEvent)) {
86243
86348
  const nativeEvent = event.nativeEvent;
86244
- target = nativeEvent.target;
86349
+ newTarget = nativeEvent.relatedTarget;
86245
86350
  if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {
86246
- target = nativeEvent.composedPath()[0];
86351
+ newTarget = nativeEvent.composedPath()[0];
86247
86352
  }
86248
86353
  }
86249
86354
  else {
86250
- target = event.target;
86355
+ newTarget = event.relatedTarget;
86251
86356
  }
86252
86357
  const container = (_b = (_a = this.tooltipHandler) === null || _a === void 0 ? void 0 : _a.getTooltipContainer) === null || _b === void 0 ? void 0 : _b.call(_a);
86253
- if (isValid$1(container) && isValid$1(target) && hasParentElement(target, container)) {
86358
+ if (isValid$1(container) && isValid$1(newTarget) && hasParentElement(newTarget, container)) {
86254
86359
  return true;
86255
86360
  }
86256
86361
  }