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

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 (112) hide show
  1. package/README.md +8 -8
  2. package/build/index.js +172 -83
  3. package/build/index.min.js +2 -2
  4. package/cjs/chart/base-chart.d.ts +1 -1
  5. package/cjs/chart/base-chart.js +2 -2
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/chart/interface/chart.d.ts +1 -0
  8. package/cjs/chart/interface/chart.js.map +1 -1
  9. package/cjs/component/brush/brush.d.ts +8 -0
  10. package/cjs/component/brush/brush.js +19 -3
  11. package/cjs/component/brush/brush.js.map +1 -1
  12. package/cjs/component/brush/interface.d.ts +8 -0
  13. package/cjs/component/brush/interface.js +7 -1
  14. package/cjs/component/brush/interface.js.map +1 -1
  15. package/cjs/component/legend/discrete/legend.js +2 -2
  16. package/cjs/component/legend/discrete/legend.js.map +1 -1
  17. package/cjs/component/tooltip/handler/base.d.ts +2 -1
  18. package/cjs/component/tooltip/handler/base.js +31 -39
  19. package/cjs/component/tooltip/handler/base.js.map +1 -1
  20. package/cjs/component/tooltip/handler/dom/interface.d.ts +0 -2
  21. package/cjs/component/tooltip/handler/dom/interface.js.map +1 -1
  22. package/cjs/component/tooltip/handler/dom/util.js +1 -3
  23. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  24. package/cjs/component/tooltip/handler/interface/style.d.ts +0 -2
  25. package/cjs/component/tooltip/handler/interface/style.js.map +1 -1
  26. package/cjs/component/tooltip/interface/spec.d.ts +2 -4
  27. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  28. package/cjs/component/tooltip/interface/theme.d.ts +0 -2
  29. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  30. package/cjs/component/tooltip/tooltip.js +6 -7
  31. package/cjs/component/tooltip/tooltip.js.map +1 -1
  32. package/cjs/constant/event.d.ts +2 -0
  33. package/cjs/constant/event.js +4 -3
  34. package/cjs/constant/event.js.map +1 -1
  35. package/cjs/constant/index.d.ts +6 -5
  36. package/cjs/constant/index.js +4 -4
  37. package/cjs/constant/index.js.map +1 -1
  38. package/cjs/constant/scatter.js +2 -1
  39. package/cjs/core/factory.js +1 -2
  40. package/cjs/core/index.d.ts +1 -1
  41. package/cjs/core/index.js +1 -1
  42. package/cjs/core/index.js.map +1 -1
  43. package/cjs/core/interface.d.ts +6 -1
  44. package/cjs/core/interface.js.map +1 -1
  45. package/cjs/core/vchart.d.ts +3 -2
  46. package/cjs/core/vchart.js +14 -0
  47. package/cjs/core/vchart.js.map +1 -1
  48. package/cjs/mark/path.js +1 -0
  49. package/cjs/mark/path.js.map +1 -1
  50. package/cjs/mark/polygon/polygon.d.ts +2 -1
  51. package/cjs/mark/polygon/polygon.js +5 -0
  52. package/cjs/mark/polygon/polygon.js.map +1 -1
  53. package/cjs/series/base/base-series.d.ts +2 -2
  54. package/cjs/series/base/base-series.js +1 -1
  55. package/cjs/series/base/base-series.js.map +1 -1
  56. package/cjs/series/range-column/rangeColumn.js +5 -5
  57. package/cjs/series/range-column/rangeColumn.js.map +1 -1
  58. package/esm/chart/base-chart.d.ts +1 -1
  59. package/esm/chart/base-chart.js +2 -2
  60. package/esm/chart/base-chart.js.map +1 -1
  61. package/esm/chart/interface/chart.d.ts +1 -0
  62. package/esm/chart/interface/chart.js.map +1 -1
  63. package/esm/component/brush/brush.d.ts +8 -0
  64. package/esm/component/brush/brush.js +19 -3
  65. package/esm/component/brush/brush.js.map +1 -1
  66. package/esm/component/brush/interface.d.ts +8 -0
  67. package/esm/component/brush/interface.js +7 -1
  68. package/esm/component/brush/interface.js.map +1 -1
  69. package/esm/component/legend/discrete/legend.js +2 -2
  70. package/esm/component/legend/discrete/legend.js.map +1 -1
  71. package/esm/component/tooltip/handler/base.d.ts +2 -1
  72. package/esm/component/tooltip/handler/base.js +28 -37
  73. package/esm/component/tooltip/handler/base.js.map +1 -1
  74. package/esm/component/tooltip/handler/dom/interface.d.ts +0 -2
  75. package/esm/component/tooltip/handler/dom/interface.js.map +1 -1
  76. package/esm/component/tooltip/handler/dom/util.js +1 -3
  77. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  78. package/esm/component/tooltip/handler/interface/style.d.ts +0 -2
  79. package/esm/component/tooltip/handler/interface/style.js.map +1 -1
  80. package/esm/component/tooltip/interface/spec.d.ts +2 -4
  81. package/esm/component/tooltip/interface/spec.js.map +1 -1
  82. package/esm/component/tooltip/interface/theme.d.ts +0 -2
  83. package/esm/component/tooltip/interface/theme.js.map +1 -1
  84. package/esm/component/tooltip/tooltip.js +7 -6
  85. package/esm/component/tooltip/tooltip.js.map +1 -1
  86. package/esm/constant/event.d.ts +2 -0
  87. package/esm/constant/event.js +4 -3
  88. package/esm/constant/event.js.map +1 -1
  89. package/esm/constant/index.d.ts +6 -5
  90. package/esm/constant/index.js +4 -4
  91. package/esm/constant/index.js.map +1 -1
  92. package/esm/constant/scatter.js +2 -1
  93. package/esm/core/factory.js +1 -2
  94. package/esm/core/index.d.ts +1 -1
  95. package/esm/core/index.js +1 -1
  96. package/esm/core/index.js.map +1 -1
  97. package/esm/core/interface.d.ts +6 -1
  98. package/esm/core/interface.js.map +1 -1
  99. package/esm/core/vchart.d.ts +3 -2
  100. package/esm/core/vchart.js +14 -1
  101. package/esm/core/vchart.js.map +1 -1
  102. package/esm/mark/path.js +1 -0
  103. package/esm/mark/path.js.map +1 -1
  104. package/esm/mark/polygon/polygon.d.ts +2 -1
  105. package/esm/mark/polygon/polygon.js +5 -0
  106. package/esm/mark/polygon/polygon.js.map +1 -1
  107. package/esm/series/base/base-series.d.ts +2 -2
  108. package/esm/series/base/base-series.js +1 -1
  109. package/esm/series/base/base-series.js.map +1 -1
  110. package/esm/series/range-column/rangeColumn.js +5 -5
  111. package/esm/series/range-column/rangeColumn.js.map +1 -1
  112. package/package.json +3 -3
package/README.md CHANGED
@@ -77,12 +77,12 @@ $ rush run -p @visactor/vchart -s test
77
77
 
78
78
  ## 🔗 Related Links
79
79
 
80
- - [Homepage](https://visactor.io/vchart)
81
- - [VCharts Gallery](todo)
82
- - [VChart Tutorials](todo)
83
- - [VChart Options](todo)
84
- - [VChart API](todo)
85
- - [VGrammar](https://visactor.io/vgrammar)
86
- - [VRender](https://visactor.io/vrender)
87
- - [FAQ](todo)
80
+ - [Homepage](https://www.visactor.io/vchart)
81
+ - [VCharts Gallery](https://www.visactor.io/vchart/example)
82
+ - [VChart Tutorials](https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Website_Guide)
83
+ - [VChart Options](https://www.visactor.io/vchart/option/)
84
+ - [VChart API](https://www.visactor.io/vchart/api/API/vchart)
85
+ - [VGrammar](https://www.visactor.io/vgrammar)
86
+ - [VRender](https://www.visactor.io/vrender)
87
+ - [FAQ](https://www.visactor.io/vchart/guide/tutorial_docs/FAQ)
88
88
  - [CodeSandbox Template](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww?file=/src/index.ts) for bug reports
package/build/index.js CHANGED
@@ -5641,25 +5641,6 @@
5641
5641
  y: actualTop
5642
5642
  };
5643
5643
  }
5644
- const getScrollLeft = element => {
5645
- var _a, _b, _c;
5646
- return element === (null === (_a = null === globalThis || void 0 === globalThis ? void 0 : globalThis.document) || void 0 === _a ? void 0 : _a.body) ? (null === (_c = null === (_b = null === globalThis || void 0 === globalThis ? void 0 : globalThis.document) || void 0 === _b ? void 0 : _b.documentElement) || void 0 === _c ? void 0 : _c.scrollLeft) || element.scrollLeft : "html" === element.tagName.toLowerCase() ? 0 : element.scrollLeft;
5647
- },
5648
- getScrollTop = element => {
5649
- var _a, _b, _c;
5650
- return element === (null === (_a = null === globalThis || void 0 === globalThis ? void 0 : globalThis.document) || void 0 === _a ? void 0 : _a.body) ? (null === (_c = null === (_b = null === globalThis || void 0 === globalThis ? void 0 : globalThis.document) || void 0 === _b ? void 0 : _b.documentElement) || void 0 === _c ? void 0 : _c.scrollTop) || element.scrollTop : "html" === element.tagName.toLowerCase() ? 0 : element.scrollTop;
5651
- };
5652
- function getElementAbsoluteScrollOffset(element) {
5653
- let actualLeft = getScrollLeft(element),
5654
- current = element.parentElement;
5655
- for (; current;) actualLeft += getScrollLeft(current), current = current.parentElement;
5656
- let actualTop = getScrollTop(element);
5657
- for (current = element.parentElement; current;) actualTop += getScrollTop(current), current = current.parentElement;
5658
- return {
5659
- x: actualLeft,
5660
- y: actualTop
5661
- };
5662
- }
5663
5644
  function hasParentElement(element, target) {
5664
5645
  let parent = element.parentNode;
5665
5646
  for (; null !== parent;) {
@@ -6845,12 +6826,33 @@
6845
6826
  l.target.addListener(event, callAd);
6846
6827
  }), this._callMap.set(call, callAd);
6847
6828
  }
6829
+ allDataViewAddListener(event, call) {
6830
+ this.multipleDataViewAddListener(Object.values(this.dataViewMap), event, call);
6831
+ }
6848
6832
  multipleDataViewRemoveListener(list, event, call) {
6849
6833
  const callAd = this._callMap.get(call);
6850
6834
  callAd && list.forEach(l => {
6851
6835
  l.target.removeListener(event, callAd);
6852
6836
  }), this._callMap.delete(call);
6853
6837
  }
6838
+ multipleDataViewUpdateInParse(newData) {
6839
+ newData.forEach(d => {
6840
+ var _a;
6841
+ return null === (_a = this.getDataView(d.name)) || void 0 === _a ? void 0 : _a.markRunning();
6842
+ }), newData.forEach(d => {
6843
+ var _a;
6844
+ return null === (_a = this.getDataView(d.name)) || void 0 === _a ? void 0 : _a.parseNewData(d.data, d.options);
6845
+ });
6846
+ }
6847
+ multipleDataViewUpdateInRawData(newData) {
6848
+ newData.forEach(d => {
6849
+ var _a;
6850
+ return null === (_a = this.getDataView(d.name)) || void 0 === _a ? void 0 : _a.markRunning();
6851
+ }), newData.forEach(d => {
6852
+ var _a;
6853
+ return null === (_a = this.getDataView(d.name)) || void 0 === _a ? void 0 : _a.updateRawData(d.data, d.options);
6854
+ });
6855
+ }
6854
6856
  destroy() {
6855
6857
  this.transformMap = null, this.parserMap = null, this.dataViewMap = null, this._callMap = null, this.target.removeAllListeners();
6856
6858
  }
@@ -47918,7 +47920,9 @@
47918
47920
  ChartEvent["playerForward"] = "playerForward";
47919
47921
  ChartEvent["playerBackward"] = "playerBackward";
47920
47922
  ChartEvent["scrollBarChange"] = "scrollBarChange";
47923
+ ChartEvent["brushStart"] = "brushStart";
47921
47924
  ChartEvent["brushChange"] = "brushChange";
47925
+ ChartEvent["brushEnd"] = "brushEnd";
47922
47926
  ChartEvent["legendSelectedDataChange"] = "legendSelectedDataChange";
47923
47927
  ChartEvent["legendFilter"] = "legendFilter";
47924
47928
  ChartEvent["legendItemClick"] = "legendItemClick";
@@ -47949,11 +47953,12 @@
47949
47953
  AttributeLevel[AttributeLevel["Default"] = 0] = "Default";
47950
47954
  AttributeLevel[AttributeLevel["Theme"] = 1] = "Theme";
47951
47955
  AttributeLevel[AttributeLevel["Chart"] = 2] = "Chart";
47952
- AttributeLevel[AttributeLevel["Series"] = 3] = "Series";
47953
- AttributeLevel[AttributeLevel["Mark"] = 4] = "Mark";
47954
- AttributeLevel[AttributeLevel["User_Chart"] = 5] = "User_Chart";
47955
- AttributeLevel[AttributeLevel["User_Series"] = 6] = "User_Series";
47956
- AttributeLevel[AttributeLevel["User_Mark"] = 7] = "User_Mark";
47956
+ AttributeLevel[AttributeLevel["Base_Series"] = 3] = "Base_Series";
47957
+ AttributeLevel[AttributeLevel["Series"] = 4] = "Series";
47958
+ AttributeLevel[AttributeLevel["Mark"] = 5] = "Mark";
47959
+ AttributeLevel[AttributeLevel["User_Chart"] = 6] = "User_Chart";
47960
+ AttributeLevel[AttributeLevel["User_Series"] = 7] = "User_Series";
47961
+ AttributeLevel[AttributeLevel["User_Mark"] = 8] = "User_Mark";
47957
47962
  AttributeLevel[AttributeLevel["Built_In"] = 99] = "Built_In";
47958
47963
  })(AttributeLevel || (AttributeLevel = {}));
47959
47964
  const STACK_FIELD_START = `${PREFIX}_STACK_START`;
@@ -51502,6 +51507,32 @@
51502
51507
  setDimensionIndex(value, opt = {}) {
51503
51508
  return this._chart?.setDimensionIndex(value, opt);
51504
51509
  }
51510
+ convertDatumToPosition(datum, dataLinkInfo = {}) {
51511
+ if (!this._chart) {
51512
+ return null;
51513
+ }
51514
+ if (isEmpty(datum)) {
51515
+ return null;
51516
+ }
51517
+ const { seriesId, seriesIndex = 0 } = dataLinkInfo;
51518
+ let series;
51519
+ if (isValid(seriesId)) {
51520
+ series = this._chart.getSeriesInUserId(seriesId);
51521
+ }
51522
+ else if (isValid(seriesIndex)) {
51523
+ series = this._chart.getSeriesInIndex([seriesIndex])?.[0];
51524
+ }
51525
+ if (series) {
51526
+ const keys = Object.keys(datum);
51527
+ const handledDatum = series
51528
+ .getViewData()
51529
+ .latestData.find((viewDatum) => keys.every(k => viewDatum[k] == datum[k]));
51530
+ if (handledDatum) {
51531
+ return series.dataToPosition(handledDatum);
51532
+ }
51533
+ }
51534
+ return null;
51535
+ }
51505
51536
  }
51506
51537
 
51507
51538
  var STATE_VALUE_ENUM;
@@ -54131,7 +54162,7 @@
54131
54162
  VChart.useMark([ComponentMark, GroupMark]);
54132
54163
  Factory.registerRegion('region', Region);
54133
54164
  Factory.registerLayout('base', Layout);
54134
- const version = "1.1.0-beta.5";
54165
+ const version = "1.1.0-beta.7";
54135
54166
 
54136
54167
  var SeriesMarkNameEnum;
54137
54168
  (function (SeriesMarkNameEnum) {
@@ -55517,7 +55548,7 @@
55517
55548
  if (!dimensionInfo) {
55518
55549
  return;
55519
55550
  }
55520
- if (opt.tooltip) {
55551
+ if (opt.tooltip !== false) {
55521
55552
  const tooltip = this._components.find(c => c.type === ComponentTypeEnum.tooltip);
55522
55553
  if (tooltip.getVisible()) {
55523
55554
  const dataFilter = {};
@@ -55536,7 +55567,7 @@
55536
55567
  tooltip.showTooltip(dataFilter, opt.showTooltipOption);
55537
55568
  }
55538
55569
  }
55539
- if (opt.crosshair) {
55570
+ if (opt.crosshair !== false) {
55540
55571
  const crosshair = this._components.find(c => c.type === ComponentTypeEnum.cartesianCrosshair);
55541
55572
  if (crosshair && crosshair.clearAxisValue && crosshair.setAxisValue) {
55542
55573
  dimensionInfo.forEach((d) => {
@@ -57280,8 +57311,8 @@
57280
57311
  this._rawDataStatistics?.reRunAllTransform();
57281
57312
  this.setSeriesField(this._spec.seriesField);
57282
57313
  this.getMarks().forEach(m => {
57283
- if (m.stateStyle.normal?.fill?.style) {
57284
- m.setAttribute('stroke', m.stateStyle.normal.fill.style, 'normal', AttributeLevel.Chart);
57314
+ if (m.stateStyle?.normal?.lineWidth) {
57315
+ m.setAttribute('stroke', this.getColorAttribute(), 'normal', AttributeLevel.Base_Series);
57285
57316
  }
57286
57317
  });
57287
57318
  }
@@ -60390,7 +60421,7 @@
60390
60421
  label: labelPosition === PositionEnum.bothEnd ? undefined : merge$1({}, this._spec.label),
60391
60422
  isSeriesMark: true
60392
60423
  });
60393
- if (labelPosition === PositionEnum.bothEnd) {
60424
+ if (this._spec.label?.visible !== false && labelPosition === PositionEnum.bothEnd) {
60394
60425
  if (this._spec.label?.minLabel?.visible !== false) {
60395
60426
  this._minLabelMark = this._createMark(RangeColumnSeries.mark.minLabel, {
60396
60427
  markSpec: this._spec.label?.minLabel
@@ -63347,6 +63378,7 @@
63347
63378
  _getDefaultStyle() {
63348
63379
  const defaultStyle = {
63349
63380
  ...super._getDefaultStyle(),
63381
+ lineWidth: 0,
63350
63382
  path: ''
63351
63383
  };
63352
63384
  return defaultStyle;
@@ -69329,6 +69361,13 @@
69329
69361
  class PolygonMark extends BasePolygonMark {
69330
69362
  static type = MarkTypeEnum.polygon;
69331
69363
  type = PolygonMark.type;
69364
+ _getDefaultStyle() {
69365
+ const defaultStyle = {
69366
+ ...super._getDefaultStyle(),
69367
+ lineWidth: 0
69368
+ };
69369
+ return defaultStyle;
69370
+ }
69332
69371
  }
69333
69372
 
69334
69373
  VChart.useMark([PolygonMark, TextMark, RuleMark]);
@@ -76697,6 +76736,22 @@
76697
76736
  this._bindLinkedSeries();
76698
76737
  this._initNeedOperatedItem();
76699
76738
  }
76739
+ _extendDataInBrush(elementsMap) {
76740
+ const data = [];
76741
+ for (const brushName in elementsMap) {
76742
+ for (const elementKey in elementsMap[brushName]) {
76743
+ data.push(elementsMap[brushName][elementKey].data[0]);
76744
+ }
76745
+ }
76746
+ return data;
76747
+ }
76748
+ _extendDatumOutOfBrush(elementsMap) {
76749
+ const data = [];
76750
+ for (const elementKey in elementsMap) {
76751
+ data.push(elementsMap[elementKey].data[0]);
76752
+ }
76753
+ return data;
76754
+ }
76700
76755
  _createBrushComponent(region, componentIndex) {
76701
76756
  const seriesRegionStartX = region.getLayoutStartPoint().x;
76702
76757
  const seriesRegionEndX = seriesRegionStartX + region.getLayoutRect().width;
@@ -76725,11 +76780,25 @@
76725
76780
  }
76726
76781
  this._reconfigItem(operateMask, region);
76727
76782
  this._reconfigLinkedItem(operateMask, region);
76728
- this.event.emit(ChartEvent.brushChange, {
76783
+ let eventType = ChartEvent.brushChange;
76784
+ if (operateType === 'brushStart' || operateType === 'brushDown') {
76785
+ eventType = ChartEvent.brushStart;
76786
+ }
76787
+ else if (operateType === 'brushEnd' || operateType === 'brushMaskUp') {
76788
+ eventType = ChartEvent.brushEnd;
76789
+ }
76790
+ else {
76791
+ eventType = ChartEvent.brushChange;
76792
+ }
76793
+ this.event.emit(eventType, {
76729
76794
  model: this,
76730
76795
  value: {
76731
76796
  operateType,
76732
76797
  operateRegion: region,
76798
+ inBrushData: this._extendDataInBrush(this._inBrushElementsMap),
76799
+ outOfBrushData: this._extendDatumOutOfBrush(this._outOfBrushElementsMap),
76800
+ linkInBrushData: this._extendDataInBrush(this._linkedInBrushElementsMap),
76801
+ linkOutOfBrushData: this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),
76733
76802
  inBrushElementsMap: this._inBrushElementsMap,
76734
76803
  outOfBrushElementsMap: this._outOfBrushElementsMap,
76735
76804
  linkedInBrushElementsMap: this._linkedInBrushElementsMap,
@@ -76780,6 +76849,7 @@
76780
76849
  graphicItem.removeState('inBrush');
76781
76850
  graphicItem.addState('outOfBrush');
76782
76851
  this._outOfBrushElementsMap[el.key] = el;
76852
+ delete this._inBrushElementsMap[operateMask.name][el.key];
76783
76853
  }
76784
76854
  });
76785
76855
  });
@@ -76951,6 +77021,16 @@
76951
77021
  }
76952
77022
  }
76953
77023
 
77024
+ var IOperateType;
77025
+ (function (IOperateType) {
77026
+ IOperateType["brushStart"] = "brushStart";
77027
+ IOperateType["brushEnd"] = "brushEnd";
77028
+ IOperateType["brushMaskUp"] = "brushMaskUp";
77029
+ IOperateType["brushing"] = "brushing";
77030
+ IOperateType["brushMaskDown"] = "brushMaskDown";
77031
+ IOperateType["brushMaskMove"] = "brushMaskMove";
77032
+ })(IOperateType || (IOperateType = {}));
77033
+
76954
77034
  function overlap$1(a, b, sep = 0) {
76955
77035
  return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
76956
77036
  }
@@ -80460,6 +80540,7 @@
80460
80540
  const originData = (this._legendData.getLatestData() || []).map((datum) => {
80461
80541
  const fill = datum.style('fill');
80462
80542
  const stroke = datum.style('stroke');
80543
+ const lineWidth = datum.style('lineWidth');
80463
80544
  const symbolType = datum.style('symbolType');
80464
80545
  const fillOpacity = datum.style('fillOpacity');
80465
80546
  const strokeOpacity = datum.style('strokeOpacity');
@@ -80473,7 +80554,7 @@
80473
80554
  shape: {
80474
80555
  fill,
80475
80556
  symbolType: symbolType ?? datum.shapeType ?? 'circle',
80476
- stroke: fill === stroke ? null : stroke,
80557
+ stroke: lineWidth === 0 || fill === stroke ? null : stroke,
80477
80558
  fillOpacity: isValidNumber(fillOpacity) ? fillOpacity : 1,
80478
80559
  strokeOpacity: isValidNumber(strokeOpacity) ? strokeOpacity : 1,
80479
80560
  opacity: isValidNumber(opacity) ? opacity : 1,
@@ -84473,7 +84554,7 @@
84473
84554
  };
84474
84555
  return actualTooltip;
84475
84556
  };
84476
- _getActualTooltipPosition = (actualTooltip, position, params, parentElement, changePositionOnly) => {
84557
+ _getActualTooltipPosition = (actualTooltip, position, params, tooltipParentElement, changePositionOnly) => {
84477
84558
  const event = params.event;
84478
84559
  const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = this._getTooltipBoxSize(actualTooltip, changePositionOnly) ?? {};
84479
84560
  const { offsetX, offsetY } = this._option;
@@ -84482,6 +84563,7 @@
84482
84563
  const canvasRect = params?.chart?.getCanvasRect();
84483
84564
  const canvasWidth = canvasRect?.width ?? DEFAULT_CHART_WIDTH;
84484
84565
  const canvasHeight = canvasRect?.height ?? DEFAULT_CHART_HEIGHT;
84566
+ let isFixedPosition = false;
84485
84567
  let left;
84486
84568
  let top;
84487
84569
  let right;
@@ -84494,6 +84576,7 @@
84494
84576
  bottom = getActualTooltipPositionValue(posBottom, event);
84495
84577
  }
84496
84578
  else if (isValid(position) && actualTooltip.activeType === 'mark') {
84579
+ isFixedPosition = true;
84497
84580
  const element = params.item;
84498
84581
  const model = params.model;
84499
84582
  const bounds = element?.getBounds();
@@ -84534,28 +84617,24 @@
84534
84617
  width: 0,
84535
84618
  height: 0
84536
84619
  };
84537
- const getDefaultOffest = () => ({ x: 0, y: 0 });
84538
- let absolutePosOffset = getDefaultOffest();
84539
- let scrollOffset = getDefaultOffest();
84540
- let parentElementScrollOffset = getDefaultOffest();
84541
- let parentElementPosOffset = getDefaultOffest();
84620
+ const getDefaultPointValue = (defaultValue = 0) => ({ x: defaultValue, y: defaultValue });
84621
+ let relativePosOffset = getDefaultPointValue();
84622
+ let tooltipParentElementPos = getDefaultPointValue();
84623
+ let chartElementScale = 1;
84624
+ let tooltipParentElementScale = 1;
84542
84625
  if (isTrueBrowser(this._env) && !tooltipSpec.confine) {
84543
84626
  containerSize.width = window.innerWidth;
84544
84627
  containerSize.height = window.innerHeight;
84545
84628
  if (!isCanvas) {
84546
- const chartRenderer = (this._compiler.getCanvas() ?? this._chartContainer);
84547
- parentElementPosOffset = getElementAbsolutePosition(parentElement);
84548
- parentElementScrollOffset = getElementAbsoluteScrollOffset(parentElement);
84549
- const chartPosOffset = getElementAbsolutePosition(chartRenderer);
84550
- const chartScrollOffset = getElementAbsoluteScrollOffset(chartRenderer);
84551
- absolutePosOffset = {
84552
- x: chartPosOffset.x - parentElementPosOffset.x,
84553
- y: chartPosOffset.y - parentElementPosOffset.y
84554
- };
84555
- scrollOffset = {
84556
- x: chartScrollOffset.x - parentElementScrollOffset.x,
84557
- y: chartScrollOffset.y - parentElementScrollOffset.y
84629
+ const chartElement = (this._compiler.getCanvas() ?? this._chartContainer);
84630
+ tooltipParentElementPos = tooltipParentElement.getBoundingClientRect();
84631
+ const chartPosOffset = chartElement.getBoundingClientRect();
84632
+ relativePosOffset = {
84633
+ x: chartPosOffset.x - tooltipParentElementPos.x,
84634
+ y: chartPosOffset.y - tooltipParentElementPos.y
84558
84635
  };
84636
+ chartElementScale = getScale(chartElement);
84637
+ tooltipParentElementScale = getScale(tooltipParentElement);
84559
84638
  }
84560
84639
  }
84561
84640
  else {
@@ -84570,7 +84649,7 @@
84570
84649
  x = canvasWidth - tooltipBoxWidth - right;
84571
84650
  }
84572
84651
  else {
84573
- x = canvasX - scrollOffset.x + offsetX;
84652
+ x = canvasX + offsetX;
84574
84653
  }
84575
84654
  if (isValidNumber(top)) {
84576
84655
  y = top;
@@ -84579,28 +84658,38 @@
84579
84658
  y = canvasHeight - tooltipBoxHeight - bottom;
84580
84659
  }
84581
84660
  else {
84582
- y = canvasY - scrollOffset.y + offsetY;
84661
+ y = canvasY + offsetY;
84583
84662
  }
84663
+ x *= chartElementScale;
84664
+ y *= chartElementScale;
84584
84665
  if (isTrueBrowser(this._env)) {
84585
- x += absolutePosOffset.x;
84586
- y += absolutePosOffset.y;
84666
+ x += relativePosOffset.x;
84667
+ y += relativePosOffset.y;
84587
84668
  }
84669
+ x /= tooltipParentElementScale;
84670
+ y /= tooltipParentElementScale;
84588
84671
  const { width: containerWidth, height: containerHeight } = containerSize;
84589
- const parentElementTotalOffset = {
84590
- x: parentElementPosOffset.x - parentElementScrollOffset.x,
84591
- y: parentElementPosOffset.y - parentElementScrollOffset.y
84592
- };
84593
- if (x + tooltipBoxWidth + parentElementTotalOffset.x > containerWidth) {
84594
- x -= offsetX * 2 + tooltipBoxWidth;
84672
+ if ((x + tooltipBoxWidth) * tooltipParentElementScale + tooltipParentElementPos.x > containerWidth) {
84673
+ if (isFixedPosition) {
84674
+ x = (containerWidth - tooltipParentElementPos.x) / tooltipParentElementScale - tooltipBoxWidth;
84675
+ }
84676
+ else {
84677
+ x -= offsetX * 2 + tooltipBoxWidth;
84678
+ }
84595
84679
  }
84596
- if (y + tooltipBoxHeight + parentElementTotalOffset.y > containerHeight) {
84597
- y -= offsetY * 2 + tooltipBoxHeight;
84680
+ if ((y + tooltipBoxHeight) * tooltipParentElementScale + tooltipParentElementPos.y > containerHeight) {
84681
+ if (isFixedPosition) {
84682
+ y = (containerHeight - tooltipParentElementPos.y) / tooltipParentElementScale - tooltipBoxHeight;
84683
+ }
84684
+ else {
84685
+ y -= offsetY * 2 + tooltipBoxHeight;
84686
+ }
84598
84687
  }
84599
- if (x + parentElementTotalOffset.x < 0) {
84600
- x = 0 - parentElementTotalOffset.x;
84688
+ if (x * tooltipParentElementScale + tooltipParentElementPos.x < 0) {
84689
+ x = 0 - tooltipParentElementPos.x / tooltipParentElementScale;
84601
84690
  }
84602
- if (y + parentElementTotalOffset.y < 0) {
84603
- y = 0 - parentElementTotalOffset.y;
84691
+ if (y * tooltipParentElementScale + tooltipParentElementPos.y < 0) {
84692
+ y = 0 - tooltipParentElementPos.y / tooltipParentElementScale;
84604
84693
  }
84605
84694
  return { x, y };
84606
84695
  };
@@ -84615,7 +84704,7 @@
84615
84704
  }
84616
84705
  _getStyle() {
84617
84706
  const tooltipSpec = this._component.getSpec();
84618
- const { style = {}, maxWidth, minWidth, enterable, transitionDuration } = tooltipSpec;
84707
+ const { style = {}, enterable, transitionDuration } = tooltipSpec;
84619
84708
  const { panel: { backgroundColor, border, shadow, padding }, titleLabel, shape, keyLabel, valueLabel, spaceRow } = style;
84620
84709
  const panelStyle = {
84621
84710
  lineWidth: border?.width ?? 0,
@@ -84650,8 +84739,6 @@
84650
84739
  key: getTextAttributes(keyLabel, globalTheme),
84651
84740
  value: getTextAttributes(valueLabel, globalTheme),
84652
84741
  padding,
84653
- minWidth,
84654
- maxWidth,
84655
84742
  spaceRow,
84656
84743
  enterable,
84657
84744
  transitionDuration
@@ -84673,6 +84760,12 @@
84673
84760
  this._initFromSpec();
84674
84761
  }
84675
84762
  }
84763
+ const getScale = (element) => {
84764
+ if (element.offsetWidth > 0) {
84765
+ return element.getBoundingClientRect().width / element.offsetWidth;
84766
+ }
84767
+ return element.getBoundingClientRect().height / element.offsetHeight;
84768
+ };
84676
84769
 
84677
84770
  const DEFAULT_SHAPE_SPACING = 8;
84678
84771
  const DEFAULT_KEY_SPACING = 26;
@@ -84687,7 +84780,7 @@
84687
84780
  return defaultStr ?? 'initial';
84688
84781
  };
84689
84782
  function getDomStyles(style, attributeCache) {
84690
- const { panel: { fill: fillColor, shadow, shadowBlur, shadowColor, shadowOffsetX, shadowOffsetY, shadowSpread, cornerRadius, stroke: strokeColor, lineWidth = 0 }, padding, key, value, title, shape, maxWidth, minWidth, enterable, spaceRow, transitionDuration } = style;
84783
+ const { panel: { fill: fillColor, shadow, shadowBlur, shadowColor, shadowOffsetX, shadowOffsetY, shadowSpread, cornerRadius, stroke: strokeColor, lineWidth = 0 }, padding, key, value, title, shape, enterable, spaceRow, transitionDuration } = style;
84691
84784
  const backgroundColor = fillColor;
84692
84785
  const styles = {
84693
84786
  panel: {
@@ -84704,8 +84797,6 @@
84704
84797
  boxShadow: shadow
84705
84798
  ? `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowSpread}px ${shadowColor}`
84706
84799
  : 'initial',
84707
- maxWidth: getPixelPropertyStr(maxWidth),
84708
- minWidth: getPixelPropertyStr(minWidth),
84709
84800
  pointerEvents: enterable ? 'auto' : 'none',
84710
84801
  transitionDuration: transitionDuration ? `${transitionDuration}ms` : 'initial',
84711
84802
  transitionProperty: transitionDuration ? 'transform' : 'initial',
@@ -85953,7 +86044,12 @@
85953
86044
  };
85954
86045
  }
85955
86046
  if (isValid(userSpec.parentElement)) {
85956
- this._spec.parentElement = userSpec.parentElement;
86047
+ if (isString(userSpec.parentElement)) {
86048
+ this._spec.parentElement = globalThis.document?.getElementById(userSpec.parentElement);
86049
+ }
86050
+ else {
86051
+ this._spec.parentElement = userSpec.parentElement;
86052
+ }
85957
86053
  }
85958
86054
  else if (isTrueBrowser(this._option.mode)) {
85959
86055
  this._spec.parentElement = domDocument?.body;
@@ -86015,16 +86111,9 @@
86015
86111
  return false;
86016
86112
  }
86017
86113
  const { x, y } = point;
86018
- const container = globalInstance.getContainer();
86019
- const { x: chartX, y: chartY } = getElementAbsolutePosition(container);
86020
- const { x: scrollOffsetX, y: scrollOffsetY } = getElementAbsoluteScrollOffset(container);
86021
- const canvasRect = chart.getCanvasRect();
86022
- const chartWidth = canvasRect?.width;
86023
- const chartHeight = canvasRect?.height;
86024
- if (x >= chartX - scrollOffsetX &&
86025
- x <= chartX + chartWidth - scrollOffsetX &&
86026
- y >= chartY - scrollOffsetY &&
86027
- y <= chartY + chartHeight - scrollOffsetY) {
86114
+ const canvas = globalInstance.getCanvas();
86115
+ const { x: chartX, y: chartY, width: chartWidth, height: chartHeight } = canvas.getBoundingClientRect();
86116
+ if (x >= chartX && x <= chartX + chartWidth && y >= chartY && y <= chartY + chartHeight) {
86028
86117
  return true;
86029
86118
  }
86030
86119
  return false;