@visactor/vchart 1.12.2-alpha.3 → 1.12.2-alpha.9

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 (147) hide show
  1. package/build/index.js +369 -424
  2. package/build/index.min.js +1 -1
  3. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  4. package/cjs/component/axis/cartesian/linear-axis.js +1 -1
  5. package/cjs/component/axis/cartesian/linear-axis.js.map +1 -1
  6. package/cjs/component/axis/interface/spec.js.map +1 -1
  7. package/cjs/component/tooltip/constant.d.ts +2 -1
  8. package/cjs/component/tooltip/constant.js +2 -2
  9. package/cjs/component/tooltip/constant.js.map +1 -1
  10. package/cjs/component/tooltip/interface/common.d.ts +3 -3
  11. package/cjs/component/tooltip/interface/common.js.map +1 -1
  12. package/cjs/component/tooltip/processor/base.d.ts +3 -4
  13. package/cjs/component/tooltip/processor/base.js +6 -39
  14. package/cjs/component/tooltip/processor/base.js.map +1 -1
  15. package/cjs/component/tooltip/processor/dimension-tooltip.d.ts +2 -1
  16. package/cjs/component/tooltip/processor/dimension-tooltip.js +37 -6
  17. package/cjs/component/tooltip/processor/dimension-tooltip.js.map +1 -1
  18. package/cjs/component/tooltip/processor/group-tooltip.d.ts +2 -3
  19. package/cjs/component/tooltip/processor/group-tooltip.js +3 -12
  20. package/cjs/component/tooltip/processor/group-tooltip.js.map +1 -1
  21. package/cjs/component/tooltip/processor/interface.d.ts +0 -1
  22. package/cjs/component/tooltip/processor/interface.js.map +1 -1
  23. package/cjs/component/tooltip/processor/mark-tooltip.d.ts +2 -3
  24. package/cjs/component/tooltip/processor/mark-tooltip.js +4 -13
  25. package/cjs/component/tooltip/processor/mark-tooltip.js.map +1 -1
  26. package/cjs/component/tooltip/tooltip-transformer.js +2 -2
  27. package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
  28. package/cjs/component/tooltip/tooltip.js +20 -22
  29. package/cjs/component/tooltip/tooltip.js.map +1 -1
  30. package/cjs/component/tooltip/utils/common.d.ts +3 -1
  31. package/cjs/component/tooltip/utils/common.js +19 -2
  32. package/cjs/component/tooltip/utils/common.js.map +1 -1
  33. package/cjs/component/tooltip/utils/compose.js +1 -1
  34. package/cjs/component/tooltip/utils/compose.js.map +1 -1
  35. package/cjs/component/tooltip/utils/get-spec.js +64 -81
  36. package/cjs/component/tooltip/utils/get-spec.js.map +1 -1
  37. package/cjs/component/tooltip/utils/index.d.ts +0 -1
  38. package/cjs/component/tooltip/utils/index.js +1 -1
  39. package/cjs/component/tooltip/utils/index.js.map +1 -1
  40. package/cjs/constant/correlation.js +1 -2
  41. package/cjs/constant/layout.js +2 -1
  42. package/cjs/core/index.d.ts +1 -1
  43. package/cjs/core/index.js +1 -1
  44. package/cjs/core/index.js.map +1 -1
  45. package/cjs/event/events/dimension/util/cartesian.d.ts +1 -1
  46. package/cjs/event/events/dimension/util/cartesian.js +6 -4
  47. package/cjs/event/events/dimension/util/cartesian.js.map +1 -1
  48. package/cjs/event/events/dimension/util/polar.js +4 -2
  49. package/cjs/event/events/dimension/util/polar.js.map +1 -1
  50. package/cjs/plugin/components/tooltip-handler/base.js +27 -64
  51. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  52. package/cjs/plugin/components/tooltip-handler/utils/position.d.ts +3 -4
  53. package/cjs/plugin/components/tooltip-handler/utils/position.js +8 -11
  54. package/cjs/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  55. package/cjs/series/base/tooltip-helper.d.ts +1 -3
  56. package/cjs/series/base/tooltip-helper.js +5 -30
  57. package/cjs/series/base/tooltip-helper.js.map +1 -1
  58. package/cjs/series/dot/tooltip-helper.d.ts +0 -1
  59. package/cjs/series/dot/tooltip-helper.js +2 -19
  60. package/cjs/series/dot/tooltip-helper.js.map +1 -1
  61. package/cjs/series/interface/series.d.ts +2 -0
  62. package/cjs/series/interface/series.js.map +1 -1
  63. package/cjs/series/pie/interface.d.ts +1 -1
  64. package/cjs/series/pie/interface.js.map +1 -1
  65. package/cjs/series/pie/pie-transformer.js +2 -2
  66. package/cjs/series/pie/pie-transformer.js.map +1 -1
  67. package/cjs/series/polar/polar.js.map +1 -1
  68. package/cjs/series/sankey/sankey.d.ts +1 -0
  69. package/cjs/series/sankey/sankey.js +23 -12
  70. package/cjs/series/sankey/sankey.js.map +1 -1
  71. package/esm/component/axis/cartesian/axis.js.map +1 -1
  72. package/esm/component/axis/cartesian/linear-axis.js +1 -1
  73. package/esm/component/axis/cartesian/linear-axis.js.map +1 -1
  74. package/esm/component/axis/interface/spec.js.map +1 -1
  75. package/esm/component/tooltip/constant.d.ts +2 -1
  76. package/esm/component/tooltip/constant.js +2 -0
  77. package/esm/component/tooltip/constant.js.map +1 -1
  78. package/esm/component/tooltip/interface/common.d.ts +3 -3
  79. package/esm/component/tooltip/interface/common.js.map +1 -1
  80. package/esm/component/tooltip/processor/base.d.ts +3 -4
  81. package/esm/component/tooltip/processor/base.js +7 -44
  82. package/esm/component/tooltip/processor/base.js.map +1 -1
  83. package/esm/component/tooltip/processor/dimension-tooltip.d.ts +2 -1
  84. package/esm/component/tooltip/processor/dimension-tooltip.js +43 -6
  85. package/esm/component/tooltip/processor/dimension-tooltip.js.map +1 -1
  86. package/esm/component/tooltip/processor/group-tooltip.d.ts +2 -3
  87. package/esm/component/tooltip/processor/group-tooltip.js +4 -13
  88. package/esm/component/tooltip/processor/group-tooltip.js.map +1 -1
  89. package/esm/component/tooltip/processor/interface.d.ts +0 -1
  90. package/esm/component/tooltip/processor/interface.js.map +1 -1
  91. package/esm/component/tooltip/processor/mark-tooltip.d.ts +2 -3
  92. package/esm/component/tooltip/processor/mark-tooltip.js +3 -14
  93. package/esm/component/tooltip/processor/mark-tooltip.js.map +1 -1
  94. package/esm/component/tooltip/tooltip-transformer.js +1 -1
  95. package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
  96. package/esm/component/tooltip/tooltip.js +21 -23
  97. package/esm/component/tooltip/tooltip.js.map +1 -1
  98. package/esm/component/tooltip/utils/common.d.ts +3 -1
  99. package/esm/component/tooltip/utils/common.js +15 -1
  100. package/esm/component/tooltip/utils/common.js.map +1 -1
  101. package/esm/component/tooltip/utils/compose.js +2 -2
  102. package/esm/component/tooltip/utils/compose.js.map +1 -1
  103. package/esm/component/tooltip/utils/get-spec.js +61 -81
  104. package/esm/component/tooltip/utils/get-spec.js.map +1 -1
  105. package/esm/component/tooltip/utils/index.d.ts +0 -1
  106. package/esm/component/tooltip/utils/index.js +0 -2
  107. package/esm/component/tooltip/utils/index.js.map +1 -1
  108. package/esm/constant/correlation.js +1 -2
  109. package/esm/constant/layout.js +2 -1
  110. package/esm/core/index.d.ts +1 -1
  111. package/esm/core/index.js +1 -1
  112. package/esm/core/index.js.map +1 -1
  113. package/esm/event/events/dimension/util/cartesian.d.ts +1 -1
  114. package/esm/event/events/dimension/util/cartesian.js +6 -4
  115. package/esm/event/events/dimension/util/cartesian.js.map +1 -1
  116. package/esm/event/events/dimension/util/polar.js +3 -1
  117. package/esm/event/events/dimension/util/polar.js.map +1 -1
  118. package/esm/plugin/components/tooltip-handler/base.js +20 -57
  119. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  120. package/esm/plugin/components/tooltip-handler/utils/position.d.ts +3 -4
  121. package/esm/plugin/components/tooltip-handler/utils/position.js +8 -11
  122. package/esm/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  123. package/esm/series/base/tooltip-helper.d.ts +1 -3
  124. package/esm/series/base/tooltip-helper.js +4 -25
  125. package/esm/series/base/tooltip-helper.js.map +1 -1
  126. package/esm/series/dot/tooltip-helper.d.ts +0 -1
  127. package/esm/series/dot/tooltip-helper.js +3 -20
  128. package/esm/series/dot/tooltip-helper.js.map +1 -1
  129. package/esm/series/interface/series.d.ts +2 -0
  130. package/esm/series/interface/series.js.map +1 -1
  131. package/esm/series/pie/interface.d.ts +1 -1
  132. package/esm/series/pie/interface.js.map +1 -1
  133. package/esm/series/pie/pie-transformer.js +1 -1
  134. package/esm/series/pie/pie-transformer.js.map +1 -1
  135. package/esm/series/polar/polar.js.map +1 -1
  136. package/esm/series/sankey/sankey.d.ts +1 -0
  137. package/esm/series/sankey/sankey.js +21 -12
  138. package/esm/series/sankey/sankey.js.map +1 -1
  139. package/package.json +16 -16
  140. package/build/es5/index.js +0 -15
  141. package/build/tsconfig.tsbuildinfo +0 -1
  142. package/cjs/component/tooltip/utils/pattern.d.ts +0 -4
  143. package/cjs/component/tooltip/utils/pattern.js +0 -13
  144. package/cjs/component/tooltip/utils/pattern.js.map +0 -1
  145. package/esm/component/tooltip/utils/pattern.d.ts +0 -4
  146. package/esm/component/tooltip/utils/pattern.js +0 -5
  147. package/esm/component/tooltip/utils/pattern.js.map +0 -1
package/build/index.js CHANGED
@@ -35878,7 +35878,7 @@
35878
35878
  } = breakData(),
35879
35879
  domain = scale.domain();
35880
35880
  scaleTicks = [];
35881
- for (let i = 0; i < domain.length; i++) if (i < domain.length - 1) {
35881
+ for (let i = 0; i < domain.length - 1; i++) {
35882
35882
  getTicks(count, [domain[i], domain[i + 1]]).forEach(tick => {
35883
35883
  breakRanges.some(breakRange => tick >= breakRange[0] && tick <= breakRange[1]) || scaleTicks.push(tick);
35884
35884
  });
@@ -35935,7 +35935,7 @@
35935
35935
  AABBBounds: bounds,
35936
35936
  value: scaleTicks[i]
35937
35937
  }));
35938
- const samplingMethod = breakData ? methods$1.greedy : methods$1.parity;
35938
+ const samplingMethod = breakData && breakData() ? methods$1.greedy : methods$1.parity;
35939
35939
  for (; items.length >= 3 && hasOverlap$1(items, labelGap);) items = samplingMethod(items, labelGap);
35940
35940
  const ticks = items.map(item => item.value);
35941
35941
  ticks.length < 3 && labelFlush && (ticks.length > 1 && ticks.pop(), last(ticks) !== last(scaleTicks) && ticks.push(last(scaleTicks))), scaleTicks = ticks;
@@ -48891,6 +48891,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
48891
48891
  isProgressive() {
48892
48892
  return this.renderContext && (!!this.renderContext.progressive || !!this.renderContext.beforeTransformProgressive);
48893
48893
  }
48894
+ canAnimateAfterProgressive() {
48895
+ return this.renderContext && this.renderContext.beforeTransformProgressive && this.renderContext.beforeTransformProgressive.canAnimate();
48896
+ }
48894
48897
  isDoingProgressive() {
48895
48898
  return this.renderContext && (this.renderContext.progressive && this.renderContext.progressive.currentIndex < this.renderContext.progressive.totalStep || this.renderContext.beforeTransformProgressive && this.renderContext.beforeTransformProgressive.unfinished());
48896
48899
  }
@@ -50671,7 +50674,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
50671
50674
  if (this._progressiveMarks && this._progressiveMarks.some(mark => mark.isDoingProgressive())) {
50672
50675
  const raf = vglobal.getRequestAnimationFrame();
50673
50676
  this._progressiveRafId = raf(this.handleProgressiveFrame);
50674
- }
50677
+ } else this._progressiveMarks && this._progressiveMarks.every(mark => mark.canAnimateAfterProgressive()) ? this.animate.animate() : this._progressiveMarks && (this._progressiveMarks = null);
50675
50678
  }
50676
50679
  clearProgressive() {
50677
50680
  if (this._progressiveRafId) {
@@ -51969,9 +51972,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
51969
51972
  data: labelData
51970
51973
  } = attributes,
51971
51974
  restAttribute = __rest(attributes, ["data"]);
51972
- return Object.assign({
51975
+ return Object.assign(Object.assign({}, merge$2({}, themeDatum, restAttribute)), {
51973
51976
  data: labelData
51974
- }, merge$2({}, themeDatum, restAttribute));
51977
+ });
51975
51978
  };
51976
51979
  mark.elements.forEach(element => {
51977
51980
  if ("willRelease" !== element.getGraphicItem().releaseStatus) if (mark.isCollectionMark()) {
@@ -54436,11 +54439,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
54436
54439
  if (!chart) {
54437
54440
  return null;
54438
54441
  }
54439
- const { x, y } = pos;
54440
54442
  const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
54441
54443
  const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
54444
+ if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
54445
+ return null;
54446
+ }
54442
54447
  const targetAxisInfo = [];
54443
54448
  const getDimensionField = (series) => series.getDimensionField()[0];
54449
+ const { x, y } = pos;
54444
54450
  if (angleAxisList) {
54445
54451
  angleAxisList.forEach(axis => {
54446
54452
  var _a;
@@ -54583,6 +54589,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
54583
54589
  const { x, y } = pos;
54584
54590
  const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
54585
54591
  const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
54592
+ if (!xAxisList.length && !yAxisList.length) {
54593
+ return null;
54594
+ }
54586
54595
  const bandAxisSet = new Set();
54587
54596
  const linearAxisSet = new Set();
54588
54597
  const forceAxisSet = new Set();
@@ -54606,14 +54615,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
54606
54615
  axisList.forEach(axis => {
54607
54616
  if (forceAxisSet.size > 0) {
54608
54617
  if (forceAxisSet.has(axis)) {
54609
- const info = getDimensionInfoByPosition(axis, posValue, orient, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
54618
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
54610
54619
  info && targetAxisInfo.push(info);
54611
54620
  }
54612
54621
  }
54613
54622
  else {
54614
54623
  const hasDiscreteAxis = bandAxisSet.size > 0;
54615
54624
  if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
54616
- const info = getDimensionInfoByPosition(axis, posValue, orient, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
54625
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
54617
54626
  info && targetAxisInfo.push(info);
54618
54627
  }
54619
54628
  }
@@ -54636,7 +54645,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
54636
54645
  }
54637
54646
  return targetAxisInfo;
54638
54647
  };
54639
- const getDimensionInfoByPosition = (axis, posValue, posKey, getDimensionField) => {
54648
+ const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
54640
54649
  const value = axis.positionToData(posValue, true);
54641
54650
  return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
54642
54651
  };
@@ -60988,7 +60997,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
60988
60997
  };
60989
60998
  registerVChartCore();
60990
60999
 
60991
- const version = "1.12.2-alpha.3";
61000
+ const version = "1.12.2-alpha.9";
60992
61001
 
60993
61002
  const addVChartProperty = (data, op) => {
60994
61003
  const context = op.beforeCall();
@@ -61015,28 +61024,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61015
61024
  }
61016
61025
  }
61017
61026
 
61018
- const getTooltipActualActiveType = (spec) => {
61019
- var _a, _b, _c;
61020
- if ((spec === null || spec === void 0 ? void 0 : spec.visible) === false) {
61021
- return [];
61022
- }
61023
- const activeTypeMap = {
61024
- mark: ((_a = spec === null || spec === void 0 ? void 0 : spec.mark) === null || _a === void 0 ? void 0 : _a.visible) !== false,
61025
- dimension: ((_b = spec === null || spec === void 0 ? void 0 : spec.dimension) === null || _b === void 0 ? void 0 : _b.visible) !== false,
61026
- group: ((_c = spec === null || spec === void 0 ? void 0 : spec.group) === null || _c === void 0 ? void 0 : _c.visible) !== false
61027
- };
61028
- if (isValid$1(spec === null || spec === void 0 ? void 0 : spec.activeType)) {
61029
- Object.keys(activeTypeMap).forEach(t => {
61030
- var _a;
61031
- activeTypeMap[t] = (_a = spec === null || spec === void 0 ? void 0 : spec.activeType) === null || _a === void 0 ? void 0 : _a.includes(t);
61032
- });
61033
- }
61034
- return Object.keys(activeTypeMap).filter(t => activeTypeMap[t]);
61035
- };
61036
- function isEmptyPos(params) {
61037
- return isNil$1(params.mark) && isNil$1(params.model) && isNil$1(params.datum);
61038
- }
61039
-
61040
61027
  class BaseSeriesTooltipHelper extends BaseTooltipHelper {
61041
61028
  constructor(series) {
61042
61029
  super();
@@ -61115,22 +61102,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61115
61102
  this.updateTooltipSpec();
61116
61103
  }
61117
61104
  updateTooltipSpec() {
61118
- var _a, _b, _c, _d;
61119
- const seriesTooltipSpec = (_b = (_a = this.series.getSpec()) === null || _a === void 0 ? void 0 : _a.tooltip) !== null && _b !== void 0 ? _b : {};
61120
- const chartTooltipSpec = (_d = (_c = this.series.getChart().getSpec()) === null || _c === void 0 ? void 0 : _c.tooltip) !== null && _d !== void 0 ? _d : {};
61121
- const spec = Object.assign(Object.assign({}, chartTooltipSpec), seriesTooltipSpec);
61122
- ['mark', 'dimension', 'group'].forEach(activeType => {
61123
- const pattern = spec[activeType];
61124
- if (isValid$1(pattern)) {
61125
- spec[activeType] = Object.assign(Object.assign({}, pattern), { title: addExtraInfoToTooltipTitlePattern(pattern.title, {
61126
- seriesId: this.series.id
61127
- }, true), content: addExtraInfoToTooltipContentPattern(pattern.content, {
61128
- seriesId: this.series.id
61129
- }, true) });
61130
- }
61131
- });
61132
- this.spec = spec;
61133
- this.activeType = getTooltipActualActiveType(spec);
61105
+ var _a;
61106
+ const seriesTooltipSpec = (_a = this.series.getSpec()) === null || _a === void 0 ? void 0 : _a.tooltip;
61107
+ this.spec = seriesTooltipSpec;
61134
61108
  this._seriesCacheInfo = this._getSeriesCacheInfo();
61135
61109
  }
61136
61110
  getDefaultTooltipPattern(activeType, dimensionInfo) {
@@ -61211,26 +61185,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61211
61185
  return null;
61212
61186
  }
61213
61187
  }
61214
- const merge = (source, extraInfo, overwrite) => {
61215
- const info = isFunction$1(extraInfo) ? extraInfo(source) : extraInfo;
61216
- return overwrite ? Object.assign(Object.assign({}, source), info) : Object.assign(Object.assign({}, info), source);
61217
- };
61218
- const addExtraInfoToTooltipTitlePattern = (pattern, extraInfo, overwrite) => {
61219
- const result = isValid$1(pattern)
61220
- ? isFunction$1(pattern)
61221
- ? (...args) => merge(pattern(...args), extraInfo, overwrite)
61222
- : merge(pattern, extraInfo, overwrite)
61223
- : undefined;
61224
- return result;
61225
- };
61226
- const addExtraInfoToTooltipContentPattern = (pattern, extraInfo, overwrite) => {
61227
- const result = isValid$1(pattern)
61228
- ? array(pattern).map(patternItem => isFunction$1(patternItem)
61229
- ? (...args) => array(patternItem(...args)).map(line => merge(line, extraInfo, overwrite))
61230
- : merge(patternItem, extraInfo, overwrite))
61231
- : undefined;
61232
- return result;
61233
- };
61234
61188
 
61235
61189
  const methods = {
61236
61190
  min: (arr) => {
@@ -66291,7 +66245,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66291
66245
  else {
66292
66246
  gapRatio = gap / axisLength;
66293
66247
  }
66294
- const symbolAngle = isValidNumber$1(breakSymbol.angle) ? breakSymbol.angle : isX ? 60 : 15;
66248
+ const symbolAngle = isValidNumber$1(breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.angle) ? breakSymbol.angle : isX ? 60 : 15;
66295
66249
  return {
66296
66250
  range: [ratio - gapRatio / 2, ratio + gapRatio / 2],
66297
66251
  breakSymbol: Object.assign(Object.assign({ visible: true }, breakSymbol), { angle: (symbolAngle * Math.PI) / 180 }),
@@ -74227,7 +74181,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74227
74181
  const specFromChart = this._getDefaultSpecFromChart(chartSpec);
74228
74182
  newSpec = mergeSpec({}, this._theme, specFromChart, spec);
74229
74183
  const getMergedLabelSpec = (position, label) => {
74230
- if (position === 'inside') {
74184
+ if (position === 'inside' || position === 'inside-center') {
74231
74185
  return mergeSpec({}, this._theme.innerLabel, label);
74232
74186
  }
74233
74187
  return mergeSpec({}, this._theme.outerLabel, label);
@@ -75843,32 +75797,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
75843
75797
  };
75844
75798
 
75845
75799
  class DotSeriesTooltipHelper extends BaseSeriesTooltipHelper {
75846
- updateTooltipSpec() {
75847
- var _a;
75848
- super.updateTooltipSpec();
75849
- if (isValid$1((_a = this.spec) === null || _a === void 0 ? void 0 : _a.mark)) {
75850
- this.spec.mark.updateContent = (prev, datum, params) => {
75851
- const childrenContent = [];
75852
- const childrenPrev = prev.filter((p) => p.key === 'children');
75853
- childrenPrev.length > 0 &&
75854
- childrenPrev[0].value.forEach((element) => {
75855
- let flag = true;
75856
- for (const key in element) {
75857
- childrenContent.push({
75858
- shapeType: 'circle',
75859
- hasShape: flag,
75860
- shapeColor: this.shapeColorCallback(datum[0].datum[0]),
75861
- shapeStroke: this.shapeStrokeCallback(datum[0].datum[0]),
75862
- key: key,
75863
- value: element[key] + ''
75864
- });
75865
- flag = false;
75866
- }
75867
- });
75868
- return prev.concat(childrenContent);
75869
- };
75870
- }
75871
- }
75872
75800
  getDefaultTooltipPattern(activeType) {
75873
75801
  if (activeType === 'mark') {
75874
75802
  return {
@@ -75916,20 +75844,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
75916
75844
  ],
75917
75845
  updateContent: (prev, datum, params) => {
75918
75846
  const childrenContent = [];
75919
- prev[3].value.forEach((element) => {
75920
- let flag = true;
75921
- for (const key in element) {
75922
- childrenContent.push({
75923
- shapeType: 'circle',
75924
- hasShape: flag,
75925
- shapeColor: this.shapeColorCallback(datum[0].datum[0]),
75926
- shapeStroke: this.shapeStrokeCallback(datum[0].datum[0]),
75927
- key: key,
75928
- value: element[key] + ''
75929
- });
75930
- flag = false;
75931
- }
75932
- });
75847
+ const childrenPrev = prev.filter((p) => p.key === 'children');
75848
+ childrenPrev.length > 0 &&
75849
+ childrenPrev[0].value.forEach((element) => {
75850
+ let flag = true;
75851
+ for (const key in element) {
75852
+ childrenContent.push({
75853
+ shapeType: 'circle',
75854
+ hasShape: flag,
75855
+ shapeColor: this.shapeColorCallback(datum[0].datum[0]),
75856
+ shapeStroke: this.shapeStrokeCallback(datum[0].datum[0]),
75857
+ key: key,
75858
+ value: element[key] + ''
75859
+ });
75860
+ flag = false;
75861
+ }
75862
+ });
75933
75863
  return prev.concat(childrenContent);
75934
75864
  }
75935
75865
  };
@@ -79270,6 +79200,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
79270
79200
  segmentationInput.maskCanvas = maskCanvas, this.options.onUpdateMaskCanvas && this.options.onUpdateMaskCanvas(maskCanvas), this.doLayout(), this.isImageFinished = !0, this.isLayoutFinished = !0;
79271
79201
  }
79272
79202
  }
79203
+ canAnimate() {
79204
+ return !0;
79205
+ }
79273
79206
  unfinished() {
79274
79207
  return !this.isLayoutFinished;
79275
79208
  }
@@ -82962,14 +82895,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82962
82895
  return (_g = this._colorScale) === null || _g === void 0 ? void 0 : _g.scale(sourceName);
82963
82896
  };
82964
82897
  this._handleEmphasisElement = (params) => {
82965
- var _a;
82898
+ var _a, _b, _c, _d, _e;
82966
82899
  const emphasisSpec = (_a = this._spec.emphasis) !== null && _a !== void 0 ? _a : {};
82967
82900
  const element = params.item;
82968
82901
  if (emphasisSpec.effect === 'adjacency') {
82969
- if (element && element.mark.id().includes('node')) {
82902
+ if (element && element.mark === ((_b = this._nodeMark) === null || _b === void 0 ? void 0 : _b.getProduct())) {
82970
82903
  this._handleNodeAdjacencyClick(element);
82971
82904
  }
82972
- else if (element && element.mark.id().includes('link')) {
82905
+ else if (element && element.mark === ((_c = this._linkMark) === null || _c === void 0 ? void 0 : _c.getProduct())) {
82973
82906
  this._handleLinkAdjacencyClick(element);
82974
82907
  }
82975
82908
  else {
@@ -82977,10 +82910,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82977
82910
  }
82978
82911
  }
82979
82912
  else if (emphasisSpec.effect === 'related') {
82980
- if (element && element.mark.id().includes('node')) {
82913
+ if (element && element.mark === ((_d = this._nodeMark) === null || _d === void 0 ? void 0 : _d.getProduct())) {
82981
82914
  this._handleNodeRelatedClick(element);
82982
82915
  }
82983
- else if (element && element.mark.id().includes('link')) {
82916
+ else if (element && element.mark === ((_e = this._linkMark) === null || _e === void 0 ? void 0 : _e.getProduct())) {
82984
82917
  this._handleLinkRelatedClick(element);
82985
82918
  }
82986
82919
  else {
@@ -82990,6 +82923,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82990
82923
  };
82991
82924
  this._handleClearEmpty = () => {
82992
82925
  var _a, _b;
82926
+ if (!this._needClear) {
82927
+ return;
82928
+ }
82993
82929
  const allNodeElements = (_a = this._nodeMark) === null || _a === void 0 ? void 0 : _a.getProductElements();
82994
82930
  if (!allNodeElements || !allNodeElements.length) {
82995
82931
  return;
@@ -83005,6 +82941,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83005
82941
  allLinkElements.forEach(el => {
83006
82942
  el.removeState(states);
83007
82943
  });
82944
+ this._needClear = false;
83008
82945
  };
83009
82946
  this._handleNodeAdjacencyClick = (element) => {
83010
82947
  const nodeDatum = element.getDatum();
@@ -83054,6 +82991,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83054
82991
  if (this._nodeMark) {
83055
82992
  this._highLightElements(this._nodeMark.getProductElements(), highlightNodes);
83056
82993
  }
82994
+ this._needClear = true;
83057
82995
  };
83058
82996
  this._handleLinkAdjacencyClick = (element) => {
83059
82997
  const curLinkDatum = element.getDatum();
@@ -83077,6 +83015,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83077
83015
  if (this._nodeMark) {
83078
83016
  this._highLightElements(this._nodeMark.getProductElements(), highlightNodes);
83079
83017
  }
83018
+ this._needClear = true;
83080
83019
  };
83081
83020
  this._handleNodeRelatedClick = (element) => {
83082
83021
  var _a;
@@ -83260,6 +83199,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83260
83199
  this._highLightElements(this._nodeMark.getProductElements(), highlightNodes);
83261
83200
  }
83262
83201
  }
83202
+ this._needClear = true;
83263
83203
  };
83264
83204
  this._handleLinkRelatedClick = (element) => {
83265
83205
  var _a;
@@ -83367,6 +83307,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83367
83307
  });
83368
83308
  this._highLightElements(allNodeElements, highlightNodes);
83369
83309
  }
83310
+ this._needClear = true;
83370
83311
  };
83371
83312
  }
83372
83313
  get direction() {
@@ -83541,6 +83482,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83541
83482
  this._initLinkMarkStyle();
83542
83483
  }
83543
83484
  _initNodeMarkStyle() {
83485
+ var _a, _b;
83544
83486
  const nodeMark = this._nodeMark;
83545
83487
  if (!nodeMark) {
83546
83488
  return;
@@ -83551,11 +83493,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83551
83493
  },
83552
83494
  x1: (datum) => datum.x1,
83553
83495
  y: (datum) => datum.y0,
83554
- y1: (datum) => datum.y1,
83555
- fill: this._fillByNode
83496
+ y1: (datum) => datum.y1
83556
83497
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Mark);
83498
+ this.setMarkStyle(nodeMark, {
83499
+ fill: (_b = (_a = this._spec.node.style) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : this._fillByNode
83500
+ }, 'normal', AttributeLevel.User_Mark);
83557
83501
  }
83558
83502
  _initLinkMarkStyle() {
83503
+ var _a, _b;
83559
83504
  const linkMark = this._linkMark;
83560
83505
  if (!linkMark) {
83561
83506
  return;
@@ -83566,9 +83511,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83566
83511
  y0: (datum) => datum.y0,
83567
83512
  y1: (datum) => datum.y1,
83568
83513
  thickness: (datum) => datum.thickness,
83569
- fill: this._fillByLink,
83570
83514
  direction: this.direction
83571
83515
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
83516
+ this.setMarkStyle(linkMark, {
83517
+ fill: (_b = (_a = this._spec.link.style) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : this._fillByLink
83518
+ }, 'normal', AttributeLevel.User_Mark);
83572
83519
  }
83573
83520
  initLabelMarkStyle(labelMark, labelSpec) {
83574
83521
  if (!labelMark) {
@@ -89601,31 +89548,78 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89601
89548
  return markInfoList;
89602
89549
  };
89603
89550
 
89604
- const makeDefaultPattern = (series, activeType, dimensionInfo) => {
89605
- var _a, _b;
89606
- return (_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.getDefaultTooltipPattern(activeType, dimensionInfo)) !== null && _b !== void 0 ? _b : null;
89551
+ const getTooltipActualActiveType = (spec) => {
89552
+ var _a, _b, _c;
89553
+ if ((spec === null || spec === void 0 ? void 0 : spec.visible) === false) {
89554
+ return [];
89555
+ }
89556
+ const activeTypeMap = {
89557
+ mark: ((_a = spec === null || spec === void 0 ? void 0 : spec.mark) === null || _a === void 0 ? void 0 : _a.visible) !== false,
89558
+ dimension: ((_b = spec === null || spec === void 0 ? void 0 : spec.dimension) === null || _b === void 0 ? void 0 : _b.visible) !== false,
89559
+ group: ((_c = spec === null || spec === void 0 ? void 0 : spec.group) === null || _c === void 0 ? void 0 : _c.visible) !== false
89560
+ };
89561
+ if (isValid$1(spec === null || spec === void 0 ? void 0 : spec.activeType)) {
89562
+ Object.keys(activeTypeMap).forEach(t => {
89563
+ var _a;
89564
+ activeTypeMap[t] = (_a = spec === null || spec === void 0 ? void 0 : spec.activeType) === null || _a === void 0 ? void 0 : _a.includes(t);
89565
+ });
89566
+ }
89567
+ return Object.keys(activeTypeMap).filter(t => activeTypeMap[t]);
89607
89568
  };
89569
+ const isActiveTypeVisible = (type, spec) => {
89570
+ if (!spec) {
89571
+ return true;
89572
+ }
89573
+ if (spec.visible === false) {
89574
+ return false;
89575
+ }
89576
+ if (spec[type] && spec[type].visible === false) {
89577
+ return false;
89578
+ }
89579
+ if (spec.activeType && !spec.activeType.includes(type)) {
89580
+ return false;
89581
+ }
89582
+ return true;
89583
+ };
89584
+ function isEmptyPos(params) {
89585
+ return isNil$1(params.mark) && isNil$1(params.model) && isNil$1(params.datum);
89586
+ }
89587
+ function combinePattern(patternList) {
89588
+ if (!patternList || !patternList.length) {
89589
+ return null;
89590
+ }
89591
+ const defaultPatternContent = [];
89592
+ patternList.forEach(({ content }) => {
89593
+ if (isFunction$1(content)) {
89594
+ defaultPatternContent.push(content);
89595
+ }
89596
+ else if (isArray$1(content)) {
89597
+ content.forEach(c => {
89598
+ defaultPatternContent.push(c);
89599
+ });
89600
+ }
89601
+ else if (content) {
89602
+ defaultPatternContent.push(content);
89603
+ }
89604
+ });
89605
+ if (defaultPatternContent.length) {
89606
+ return Object.assign(Object.assign({}, patternList[0]), { content: defaultPatternContent });
89607
+ }
89608
+ return patternList[0];
89609
+ }
89608
89610
 
89609
89611
  const getTooltipSpecForShow = (activeType, globalSpec, series, dimensionInfo) => {
89610
- var _a, _b, _c, _d, _e, _f, _g;
89612
+ var _a, _b, _c, _d, _e, _f;
89611
89613
  const finalSpec = Object.assign(Object.assign({}, globalSpec), { activeType });
89612
89614
  const { style = {} } = globalSpec;
89613
89615
  switch (activeType) {
89614
89616
  case 'mark':
89615
89617
  case 'group':
89616
89618
  if (series) {
89617
- const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
89618
- if (isValid$1(seriesSpec.visible) || isValid$1(seriesSpec.activeType)) {
89619
- finalSpec.visible = getTooltipActualActiveType(seriesSpec).includes(activeType);
89620
- }
89621
- else if (isValid$1(globalSpec.visible) || isValid$1(globalSpec.activeType)) {
89622
- finalSpec.visible = getTooltipActualActiveType(globalSpec).includes(activeType);
89623
- }
89624
- else {
89625
- finalSpec.visible = true;
89626
- }
89627
- finalSpec.handler = (_d = (_c = seriesSpec.handler) !== null && _c !== void 0 ? _c : globalSpec.handler) !== null && _d !== void 0 ? _d : undefined;
89628
- if ((_e = finalSpec.handler) === null || _e === void 0 ? void 0 : _e.showTooltip) {
89619
+ const seriesSpec = (_a = series.getSpec()) === null || _a === void 0 ? void 0 : _a.tooltip;
89620
+ finalSpec.visible = true;
89621
+ finalSpec.handler = (_b = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.handler) !== null && _b !== void 0 ? _b : globalSpec.handler;
89622
+ if ((_c = finalSpec.handler) === null || _c === void 0 ? void 0 : _c.showTooltip) {
89629
89623
  return finalSpec;
89630
89624
  }
89631
89625
  }
@@ -89633,165 +89627,168 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89633
89627
  case 'dimension':
89634
89628
  if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
89635
89629
  const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
89636
- if (seriesList.every(series => { var _a; return !getTooltipActualActiveType((_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec).includes('dimension'); })) {
89630
+ if (seriesList.every(series => { var _a; return !isActiveTypeVisible('dimension', (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec); })) {
89637
89631
  finalSpec.visible = false;
89638
89632
  }
89639
- else if (isValid$1(globalSpec.visible) || isValid$1(globalSpec.activeType)) {
89640
- finalSpec.visible = getTooltipActualActiveType(globalSpec).includes('dimension');
89641
- }
89642
89633
  else {
89643
89634
  finalSpec.visible = true;
89644
89635
  }
89645
- finalSpec.handler = (_f = globalSpec.handler) !== null && _f !== void 0 ? _f : undefined;
89646
- if ((_g = finalSpec.handler) === null || _g === void 0 ? void 0 : _g.showTooltip) {
89636
+ finalSpec.handler = (_d = globalSpec.handler) !== null && _d !== void 0 ? _d : undefined;
89637
+ if ((_e = finalSpec.handler) === null || _e === void 0 ? void 0 : _e.showTooltip) {
89647
89638
  return finalSpec;
89648
89639
  }
89649
89640
  }
89650
89641
  break;
89651
89642
  }
89652
- const defaultPattern = getDefaultTooltipPattern(activeType, series, dimensionInfo);
89653
- const seriesPattern = getSeriesTooltipPattern(activeType, series, dimensionInfo);
89654
- const userPattern = mergeSpec({}, cloneDeep(globalSpec[activeType]), seriesPattern);
89655
- const defaultPatternTitle = defaultPattern.title;
89656
- const titleShape = getShapePattern(undefined, userPattern, style.shape, undefined, defaultPatternTitle);
89657
- if (isValid$1(userPattern.title)) {
89658
- userPattern.title = addExtraInfoToTooltipTitlePattern(userPattern.title, Object.assign(Object.assign({}, defaultPatternTitle), titleShape));
89659
- }
89660
- else {
89661
- userPattern.title = addExtraInfoToTooltipTitlePattern(defaultPatternTitle, titleShape, true);
89662
- }
89663
- const defaultPatternContent = array(defaultPattern.content);
89664
- if (isValid$1(userPattern.content)) {
89665
- const shapePatternMap = getShapePatternMapOfEachSeries(defaultPatternContent);
89666
- userPattern.content = addExtraInfoToTooltipContentPattern(userPattern.content, userLine => getShapePattern(userLine, userPattern, style.shape, shapePatternMap));
89667
- }
89668
- else {
89669
- userPattern.content = addExtraInfoToTooltipContentPattern(defaultPatternContent, line => getShapePattern(undefined, userPattern, style.shape, undefined, line), true);
89643
+ const defaultPattern = (_f = getDefaultTooltipPattern(activeType, series, dimensionInfo)) !== null && _f !== void 0 ? _f : {};
89644
+ const userPattern = getSeriesTooltipPattern(activeType, globalSpec, series, dimensionInfo);
89645
+ if (userPattern) {
89646
+ const defaultPatternTitle = defaultPattern.title;
89647
+ const defaultTitleShape = getShapePattern(undefined, userPattern, style.shape, undefined, defaultPatternTitle);
89648
+ if (isValid$1(userPattern.title)) {
89649
+ userPattern.title = addExtraInfoToTooltipTitlePattern(userPattern.title, Object.assign(Object.assign({}, defaultPatternTitle), defaultTitleShape));
89650
+ }
89651
+ else {
89652
+ userPattern.title = addExtraInfoToTooltipTitlePattern(defaultPatternTitle, defaultTitleShape, true);
89653
+ }
89654
+ const defaultPatternContent = array(defaultPattern.content);
89655
+ if (isValid$1(userPattern.content)) {
89656
+ const shapePatternMap = getShapePatternMapOfEachSeries(defaultPatternContent);
89657
+ userPattern.content = addExtraInfoToTooltipContentPattern(userPattern.content, userLine => getShapePattern(userLine, userPattern, style.shape, shapePatternMap));
89658
+ }
89659
+ else {
89660
+ userPattern.content = addExtraInfoToTooltipContentPattern(defaultPatternContent, line => getShapePattern(undefined, userPattern, style.shape, undefined, line), true);
89661
+ }
89670
89662
  }
89671
89663
  finalSpec[activeType] = Object.assign(Object.assign(Object.assign({}, defaultPattern), userPattern), { activeType });
89672
89664
  return finalSpec;
89673
89665
  };
89674
89666
  const getDefaultTooltipPattern = (activeType, series, dimensionInfo) => {
89675
- var _a;
89676
- let defaultPattern = {};
89677
89667
  switch (activeType) {
89678
89668
  case 'mark':
89679
89669
  case 'group':
89680
89670
  if (series) {
89681
- defaultPattern = (_a = makeDefaultPattern(series, activeType)) !== null && _a !== void 0 ? _a : {};
89671
+ return series.tooltipHelper.getDefaultTooltipPattern(activeType);
89682
89672
  }
89683
89673
  break;
89684
89674
  case 'dimension':
89685
89675
  if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
89686
89676
  const patternList = [];
89687
- dimensionInfo.forEach(({ data }) => data.forEach(data => {
89688
- const { series } = data;
89677
+ dimensionInfo.forEach(info => info.data.forEach(datum => {
89678
+ const { series } = datum;
89689
89679
  const mockDimensionInfo = [
89690
- Object.assign(Object.assign({}, dimensionInfo[0]), { data: [data] })
89680
+ Object.assign(Object.assign({}, info), { data: [datum] })
89691
89681
  ];
89692
- const pattern = makeDefaultPattern(series, 'dimension', mockDimensionInfo);
89682
+ const pattern = series.tooltipHelper.getDefaultTooltipPattern(activeType, mockDimensionInfo);
89693
89683
  if (pattern) {
89694
89684
  patternList.push(pattern);
89695
89685
  }
89696
89686
  }));
89697
- const defaultPatternContent = [];
89698
- patternList.forEach(({ content }) => {
89699
- if (isFunction$1(content)) {
89700
- defaultPatternContent.push(content);
89701
- }
89702
- else {
89703
- defaultPatternContent.push(...array(content));
89704
- }
89705
- });
89706
- defaultPattern = Object.assign(Object.assign({}, patternList[0]), { content: defaultPatternContent });
89687
+ return combinePattern(patternList);
89707
89688
  }
89708
89689
  break;
89709
89690
  }
89710
- return defaultPattern;
89691
+ return undefined;
89711
89692
  };
89712
- const getSeriesTooltipPattern = (activeType, series, dimensionInfo) => {
89713
- var _a, _b;
89714
- let seriesPattern = {};
89715
- switch (activeType) {
89716
- case 'mark':
89717
- case 'group':
89718
- if (series) {
89719
- const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
89720
- seriesPattern = seriesSpec[activeType] ? cloneDeep(seriesSpec[activeType]) : {};
89721
- }
89722
- break;
89723
- case 'dimension':
89724
- if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
89725
- const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
89726
- const seriesPatternList = seriesList
89727
- .filter(series => {
89728
- var _a;
89729
- const spec = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec;
89730
- return isValid$1(spec === null || spec === void 0 ? void 0 : spec.dimension) && getTooltipActualActiveType(spec).includes('dimension');
89731
- })
89732
- .map(series => series.tooltipHelper.spec.dimension);
89733
- if (seriesPatternList.length) {
89734
- let seriesPatternContent = [];
89735
- if (seriesPatternList.every(({ content }) => isNil$1(content))) {
89736
- seriesPatternContent = undefined;
89693
+ const getSeriesTooltipPattern = (activeType, globalSpec, series, dimensionInfo) => {
89694
+ const allSeries = activeType === 'dimension' && (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length)
89695
+ ? getSeriesListFromDimensionInfo(dimensionInfo)
89696
+ : (activeType === 'mark' || activeType === 'group') && series
89697
+ ? [series]
89698
+ : null;
89699
+ if (allSeries && allSeries.length) {
89700
+ const seriesPatternList = [];
89701
+ allSeries.forEach(s => {
89702
+ var _a;
89703
+ const seriesSpec = (_a = s.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec;
89704
+ if (isActiveTypeVisible(activeType, seriesSpec)) {
89705
+ let finalPattern = seriesSpec && seriesSpec[activeType]
89706
+ ? Object.assign(Object.assign({}, globalSpec[activeType]), seriesSpec[activeType]) : globalSpec[activeType];
89707
+ if (finalPattern) {
89708
+ finalPattern = cloneDeep(finalPattern);
89709
+ if (finalPattern.title) {
89710
+ finalPattern.title = addExtraInfoToTooltipTitlePattern(finalPattern.title, {
89711
+ seriesId: s.id
89712
+ }, true);
89737
89713
  }
89738
- else {
89739
- seriesPatternList.forEach(({ content }) => {
89740
- if (isNil$1(content)) {
89741
- return;
89742
- }
89743
- if (isFunction$1(content)) {
89744
- seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(content);
89745
- }
89746
- else {
89747
- seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(...array(content));
89748
- }
89749
- });
89714
+ if (finalPattern.content) {
89715
+ finalPattern.content = addExtraInfoToTooltipContentPattern(finalPattern.content, {
89716
+ seriesId: s.id
89717
+ }, true);
89750
89718
  }
89751
- seriesPattern = Object.assign(Object.assign({}, seriesPatternList[0]), { content: seriesPatternContent });
89719
+ seriesPatternList.push(finalPattern);
89752
89720
  }
89753
89721
  }
89754
- break;
89722
+ });
89723
+ return seriesPatternList && seriesPatternList.length ? combinePattern(seriesPatternList) : null;
89755
89724
  }
89756
- return seriesPattern;
89725
+ return undefined;
89726
+ };
89727
+ const getSeriesListFromDimensionInfo = (dimensionInfo) => {
89728
+ const list = [];
89729
+ dimensionInfo.forEach(info => {
89730
+ info.data.forEach(datum => {
89731
+ if (isValid$1(datum.series)) {
89732
+ list.push(datum.series);
89733
+ }
89734
+ });
89735
+ });
89736
+ return list;
89757
89737
  };
89758
- const getSeriesListFromDimensionInfo = memoize((dimensionInfo) => {
89759
- return dimensionInfo.reduce((list, cur) => list.concat(cur.data.map(data => data.series).filter(isValid$1)), []);
89760
- });
89761
89738
  const getShapePatternMapOfEachSeries = (content) => {
89762
89739
  const shapePatternMap = {};
89763
89740
  content.forEach(line => {
89764
- var _a;
89765
- const key = (_a = line.seriesId) !== null && _a !== void 0 ? _a : 0;
89766
- if (!shapePatternMap[key]) {
89741
+ const key = line.seriesId;
89742
+ if (isValid$1(key) && !shapePatternMap[key]) {
89767
89743
  shapePatternMap[key] = line;
89768
89744
  }
89745
+ if (!shapePatternMap[-1]) {
89746
+ shapePatternMap[-1] = line;
89747
+ }
89769
89748
  });
89770
89749
  return shapePatternMap;
89771
89750
  };
89751
+ const isShapeKey = (key) => key.toLowerCase().includes('shape');
89772
89752
  const getShapePattern = (userLinePattern, userPattern, userStyle, shapePatternMap, defaultShapePattern) => {
89773
- var _a, _b, _c;
89753
+ var _a, _b;
89774
89754
  if (userStyle) {
89775
89755
  userStyle.shapeSize = (_a = userStyle.shapeSize) !== null && _a !== void 0 ? _a : userStyle.size;
89776
89756
  }
89777
- const shapePatternFromMap = (_c = shapePatternMap === null || shapePatternMap === void 0 ? void 0 : shapePatternMap[(_b = userLinePattern === null || userLinePattern === void 0 ? void 0 : userLinePattern.seriesId) !== null && _b !== void 0 ? _b : 0]) !== null && _c !== void 0 ? _c : shapePatternMap === null || shapePatternMap === void 0 ? void 0 : shapePatternMap[0];
89778
- const maps = [userLinePattern, userPattern, userStyle, shapePatternFromMap, defaultShapePattern].filter(isValid$1);
89779
- const shapeKeys = new Set(maps
89780
- .reduce((keys, cur) => keys.concat(Object.keys(cur)), [])
89781
- .filter(key => key.toLowerCase().includes('shape')));
89757
+ const shapePatternFromMap = shapePatternMap
89758
+ ? (_b = shapePatternMap[userLinePattern === null || userLinePattern === void 0 ? void 0 : userLinePattern.seriesId]) !== null && _b !== void 0 ? _b : shapePatternMap[-1]
89759
+ : null;
89782
89760
  const shapePattern = {};
89783
- shapeKeys.forEach(key => {
89784
- let value;
89785
- let i = 0;
89786
- do {
89787
- value = maps[i++][key];
89788
- } while (i < maps.length && isNil$1(value));
89789
- if (value !== undefined) {
89790
- shapePattern[key] = value;
89761
+ [userLinePattern, userPattern, userStyle, shapePatternFromMap, defaultShapePattern].forEach(cfg => {
89762
+ if (isValid$1(cfg)) {
89763
+ Object.keys(cfg).forEach(key => {
89764
+ if (isShapeKey(key) && isNil$1(shapePattern[key]) && !isNil$1(cfg[key])) {
89765
+ shapePattern[key] = cfg[key];
89766
+ }
89767
+ });
89791
89768
  }
89792
89769
  });
89793
89770
  return shapePattern;
89794
89771
  };
89772
+ const merge = (source, extraInfo, overwrite) => {
89773
+ const info = isFunction$1(extraInfo) ? extraInfo(source) : extraInfo;
89774
+ return overwrite ? Object.assign(Object.assign({}, source), info) : Object.assign(Object.assign({}, info), source);
89775
+ };
89776
+ const addExtraInfoToTooltipTitlePattern = (pattern, extraInfo, overwrite) => {
89777
+ const result = isValid$1(pattern)
89778
+ ? isFunction$1(pattern)
89779
+ ? (...args) => merge(pattern(...args), extraInfo, overwrite)
89780
+ : merge(pattern, extraInfo, overwrite)
89781
+ : undefined;
89782
+ return result;
89783
+ };
89784
+ const addExtraInfoToTooltipContentPattern = (pattern, extraInfo, overwrite) => {
89785
+ const result = isValid$1(pattern)
89786
+ ? array(pattern).map(patternItem => isFunction$1(patternItem)
89787
+ ? (...args) => array(patternItem(...args)).map(line => merge(line, extraInfo, overwrite))
89788
+ : merge(patternItem, extraInfo, overwrite))
89789
+ : undefined;
89790
+ return result;
89791
+ };
89795
89792
 
89796
89793
  const getTooltipContentValue = (field, datum, params, formatter) => {
89797
89794
  let value;
@@ -89860,6 +89857,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89860
89857
  key: '其他',
89861
89858
  value: '...'
89862
89859
  };
89860
+ const TOOLTIP_TYPES = ['group', 'mark', 'dimension'];
89863
89861
 
89864
89862
  const getTimeString = (value, timeFormat, timeFormatMode) => {
89865
89863
  if (!timeFormat && !timeFormatMode) {
@@ -89936,7 +89934,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89936
89934
  case 'dimension':
89937
89935
  for (const { data: d } of data) {
89938
89936
  for (const { datum: datumList, series } of d) {
89939
- if (!getTooltipActualActiveType((_c = series.tooltipHelper) === null || _c === void 0 ? void 0 : _c.spec).includes('dimension')) {
89937
+ if (!isActiveTypeVisible('dimension', (_c = series.tooltipHelper) === null || _c === void 0 ? void 0 : _c.spec)) {
89940
89938
  continue;
89941
89939
  }
89942
89940
  const contentPatterns = (_d = patternContent === null || patternContent === void 0 ? void 0 : patternContent.filter(c => isNil$1(c.seriesId) || c.seriesId === series.id)) !== null && _d !== void 0 ? _d : [];
@@ -90070,6 +90068,48 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90070
90068
  }
90071
90069
  return undefined;
90072
90070
  }
90071
+ _updateViewSpec(params) {
90072
+ const { changePositionOnly, model, dimensionInfo } = params;
90073
+ if (!changePositionOnly || !this._cacheViewSpec) {
90074
+ this._cacheViewSpec = getTooltipSpecForShow(this.activeType, this.component.getSpec(), model, dimensionInfo);
90075
+ }
90076
+ }
90077
+ _updateActualTooltip(data, params) {
90078
+ var _a, _b, _c, _d;
90079
+ const pattern = this._cacheViewSpec[this.activeType];
90080
+ const { changePositionOnly } = params;
90081
+ if (!changePositionOnly || !this._cacheActualTooltip) {
90082
+ const tooltipContent = getShowContent(pattern, data, params);
90083
+ const visible = isValid$1(tooltipContent) ? getTooltipPatternValue(pattern.visible, data, params) !== false : false;
90084
+ this._cacheActualTooltip = Object.assign(Object.assign({}, tooltipContent), { visible, activeType: pattern.activeType, data });
90085
+ const { title, content } = this._cacheActualTooltip;
90086
+ this._cacheActualTooltip.title = (_b = (_a = pattern.updateTitle) === null || _a === void 0 ? void 0 : _a.call(pattern, title, data, params)) !== null && _b !== void 0 ? _b : title;
90087
+ this._cacheActualTooltip.content = (_d = (_c = pattern.updateContent) === null || _c === void 0 ? void 0 : _c.call(pattern, content, data, params)) !== null && _d !== void 0 ? _d : content;
90088
+ }
90089
+ }
90090
+ shouldHandleTooltip(params, mouseEventData) {
90091
+ var _a, _b;
90092
+ const { tooltipInfo: info } = mouseEventData;
90093
+ if (isNil$1(info)) {
90094
+ return false;
90095
+ }
90096
+ return isActiveTypeVisible(this.activeType, (_b = (_a = params.model) === null || _a === void 0 ? void 0 : _a.tooltipHelper) === null || _b === void 0 ? void 0 : _b.spec);
90097
+ }
90098
+ clearCache() {
90099
+ this._cacheViewSpec = undefined;
90100
+ this._cacheActualTooltip = undefined;
90101
+ }
90102
+ }
90103
+
90104
+ class DimensionTooltipProcessor extends BaseTooltipProcessor {
90105
+ constructor() {
90106
+ super(...arguments);
90107
+ this.activeType = 'dimension';
90108
+ }
90109
+ showTooltip(info, params, changePositionOnly) {
90110
+ const newParams = Object.assign(Object.assign({}, params), { dimensionInfo: this._preprocessDimensionInfo(info), changePositionOnly, tooltip: this.component });
90111
+ return this._showTooltipByHandler(info, newParams);
90112
+ }
90073
90113
  _getDimensionInfo(params) {
90074
90114
  var _a, _b;
90075
90115
  let targetDimensionInfo;
@@ -90127,53 +90167,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90127
90167
  }
90128
90168
  return targetDimensionInfo;
90129
90169
  }
90130
- _updateViewSpec(params) {
90131
- const { changePositionOnly, model, dimensionInfo } = params;
90132
- if (!changePositionOnly || !this._cacheViewSpec) {
90133
- this._cacheViewSpec = getTooltipSpecForShow(this.activeType, this.component.getSpec(), model, dimensionInfo);
90134
- }
90135
- }
90136
- _updateActualTooltip(data, params) {
90137
- var _a, _b, _c, _d;
90138
- const pattern = this._cacheViewSpec[this.activeType];
90139
- const { changePositionOnly } = params;
90140
- if (!changePositionOnly || !this._cacheActualTooltip) {
90141
- const tooltipContent = getShowContent(pattern, data, params);
90142
- const visible = isValid$1(tooltipContent) ? getTooltipPatternValue(pattern.visible, data, params) !== false : false;
90143
- this._cacheActualTooltip = Object.assign(Object.assign({}, tooltipContent), { visible, activeType: pattern.activeType, data });
90144
- const { title, content } = this._cacheActualTooltip;
90145
- this._cacheActualTooltip.title = (_b = (_a = pattern.updateTitle) === null || _a === void 0 ? void 0 : _a.call(pattern, title, data, params)) !== null && _b !== void 0 ? _b : title;
90146
- this._cacheActualTooltip.content = (_d = (_c = pattern.updateContent) === null || _c === void 0 ? void 0 : _c.call(pattern, content, data, params)) !== null && _d !== void 0 ? _d : content;
90147
- }
90148
- }
90149
- clearCache() {
90150
- this._cacheViewSpec = undefined;
90151
- this._cacheActualTooltip = undefined;
90152
- }
90153
- }
90154
-
90155
- class DimensionTooltipProcessor extends BaseTooltipProcessor {
90156
- constructor() {
90157
- super(...arguments);
90158
- this.activeType = 'dimension';
90159
- }
90160
- showTooltip(info, params, changePositionOnly) {
90161
- const newParams = Object.assign(Object.assign({}, params), { dimensionInfo: this._preprocessDimensionInfo(info), changePositionOnly, tooltip: this.component });
90162
- return this._showTooltipByHandler(info, newParams);
90163
- }
90164
- shouldHandleTooltip(params, mouseEventData) {
90165
- var _a, _b;
90166
- const { tooltipInfo: info } = mouseEventData;
90167
- if (isNil$1(info)) {
90168
- return false;
90169
- }
90170
- const helper = (_a = params.model) === null || _a === void 0 ? void 0 : _a.tooltipHelper;
90171
- const activeType = (_b = helper === null || helper === void 0 ? void 0 : helper.activeType) !== null && _b !== void 0 ? _b : this.component.getSpec().activeType;
90172
- if (!activeType.includes('dimension')) {
90173
- return false;
90174
- }
90175
- return true;
90176
- }
90177
90170
  getMouseEventData(params) {
90178
90171
  var _a;
90179
90172
  return {
@@ -90193,24 +90186,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90193
90186
  this.activeType = 'mark';
90194
90187
  }
90195
90188
  showTooltip(info, params, changePositionOnly) {
90196
- const { datum, series, dimensionInfo } = info;
90189
+ const { datum, series } = info;
90197
90190
  const tooltipData = [{ datum: [datum], series }];
90198
- const newParams = Object.assign(Object.assign({}, params), { dimensionInfo: this._preprocessDimensionInfo(dimensionInfo), changePositionOnly, tooltip: this.component });
90191
+ const newParams = Object.assign(Object.assign({}, params), { changePositionOnly, tooltip: this.component });
90199
90192
  return this._showTooltipByHandler(tooltipData, newParams);
90200
90193
  }
90201
- shouldHandleTooltip(params, mouseEventData) {
90202
- var _a;
90203
- const { tooltipInfo: info } = mouseEventData;
90204
- if (isNil$1(info)) {
90205
- return false;
90206
- }
90207
- const helper = (_a = params.model) === null || _a === void 0 ? void 0 : _a.tooltipHelper;
90208
- if (!(helper === null || helper === void 0 ? void 0 : helper.activeType.includes('mark'))) {
90209
- return false;
90210
- }
90211
- return true;
90212
- }
90213
- getMouseEventData(params, dimensionInfo) {
90194
+ getMouseEventData(params) {
90214
90195
  var _a;
90215
90196
  let info;
90216
90197
  let ignore;
@@ -90223,8 +90204,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90223
90204
  info = {
90224
90205
  mark: params.mark,
90225
90206
  datum: params.datum,
90226
- series,
90227
- dimensionInfo
90207
+ series
90228
90208
  };
90229
90209
  }
90230
90210
  else if ((ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.model)) || (ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.mark))) {
@@ -90244,24 +90224,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90244
90224
  this.activeType = 'group';
90245
90225
  }
90246
90226
  showTooltip(info, params, changePositionOnly) {
90247
- const { datum, series, dimensionInfo } = info;
90227
+ const { datum, series } = info;
90248
90228
  const tooltipData = [{ datum: array(datum), series }];
90249
- const newParams = Object.assign(Object.assign({}, params), { groupDatum: this._getGroupDatum(params), dimensionInfo: this._preprocessDimensionInfo(dimensionInfo), changePositionOnly, tooltip: this.component });
90229
+ const newParams = Object.assign(Object.assign({}, params), { groupDatum: this._getGroupDatum(params), changePositionOnly, tooltip: this.component });
90250
90230
  return this._showTooltipByHandler(tooltipData, newParams);
90251
90231
  }
90252
- shouldHandleTooltip(params, mouseEventData) {
90253
- var _a;
90254
- const { tooltipInfo: info } = mouseEventData;
90255
- if (isNil$1(info)) {
90256
- return false;
90257
- }
90258
- const helper = (_a = params.model) === null || _a === void 0 ? void 0 : _a.tooltipHelper;
90259
- if (!(helper === null || helper === void 0 ? void 0 : helper.activeType.includes('group'))) {
90260
- return false;
90261
- }
90262
- return true;
90263
- }
90264
- getMouseEventData(params, dimensionInfo) {
90232
+ getMouseEventData(params) {
90265
90233
  var _a, _b;
90266
90234
  let info;
90267
90235
  let ignore;
@@ -90277,8 +90245,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90277
90245
  info = {
90278
90246
  mark: params.mark,
90279
90247
  datum: params.datum,
90280
- series,
90281
- dimensionInfo
90248
+ series
90282
90249
  };
90283
90250
  }
90284
90251
  }
@@ -90437,12 +90404,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90437
90404
  dimension: false,
90438
90405
  group: false
90439
90406
  };
90440
- success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);
90441
- if (!success.group) {
90442
- success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);
90443
- }
90444
- if (!success.mark && !success.group) {
90445
- success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
90407
+ for (let i = 0, len = TOOLTIP_TYPES.length; i < len; i++) {
90408
+ const type = TOOLTIP_TYPES[i];
90409
+ const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false;
90410
+ if (res) {
90411
+ success[type] = true;
90412
+ break;
90413
+ }
90446
90414
  }
90447
90415
  if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {
90448
90416
  if (ignoreMark && isMarkInfo(this._cacheInfo)) {
@@ -90507,22 +90475,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90507
90475
  tooltipInfo: {},
90508
90476
  ignore: {}
90509
90477
  };
90510
- let activeType = 'dimension';
90511
- const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);
90512
- result.tooltipInfo[activeType] = tooltipInfo;
90513
- result.ignore[activeType] = ignore;
90514
- const dimensionInfo = tooltipInfo;
90515
- for (activeType of Object.keys(this.processor)) {
90516
- if (activeType !== 'dimension') {
90517
- const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params, dimensionInfo);
90518
- result.tooltipInfo[activeType] = tooltipInfo;
90519
- result.ignore[activeType] = ignore;
90520
- }
90521
- }
90478
+ Object.keys(this.processor).forEach(activeType => {
90479
+ const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);
90480
+ result.tooltipInfo[activeType] = tooltipInfo;
90481
+ result.ignore[activeType] = ignore;
90482
+ });
90522
90483
  return result;
90523
90484
  };
90524
90485
  this._hideTooltipByHandler = (params) => {
90525
- var _a, _b, _c, _d;
90486
+ var _a, _b, _c;
90526
90487
  if (!this._isTooltipShown && !((_b = (_a = this.tooltipHandler) === null || _a === void 0 ? void 0 : _a.isTooltipShown) === null || _b === void 0 ? void 0 : _b.call(_a))) {
90527
90488
  return 0;
90528
90489
  }
@@ -90530,15 +90491,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90530
90491
  Object.values(this.processor).forEach((processor) => {
90531
90492
  processor.clearCache();
90532
90493
  });
90533
- let hideTooltip;
90534
- if ((_c = this._spec.handler) === null || _c === void 0 ? void 0 : _c.hideTooltip) {
90535
- hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);
90536
- }
90537
- else if ((_d = this.tooltipHandler) === null || _d === void 0 ? void 0 : _d.hideTooltip) {
90538
- hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);
90539
- }
90540
- if (hideTooltip) {
90541
- const result = hideTooltip(params);
90494
+ const handler = (_c = this._spec.handler) !== null && _c !== void 0 ? _c : this.tooltipHandler;
90495
+ if (handler.hideTooltip) {
90496
+ const result = handler.hideTooltip.call(handler, params);
90542
90497
  if (!result) {
90543
90498
  this._isTooltipShown = false;
90544
90499
  }
@@ -90639,11 +90594,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90639
90594
  }
90640
90595
  }
90641
90596
  _initProcessor() {
90642
- this.processor = {
90643
- mark: new MarkTooltipProcessor(this),
90644
- dimension: new DimensionTooltipProcessor(this),
90645
- group: new GroupTooltipProcessor(this)
90646
- };
90597
+ const activeType = this._spec.activeType;
90598
+ this.processor = {};
90599
+ if (activeType.includes('dimension')) {
90600
+ this.processor.dimension = new DimensionTooltipProcessor(this);
90601
+ }
90602
+ if (activeType.includes('group')) {
90603
+ this.processor.group = new GroupTooltipProcessor(this);
90604
+ }
90605
+ if (activeType.includes('mark')) {
90606
+ this.processor.mark = new MarkTooltipProcessor(this);
90607
+ }
90647
90608
  }
90648
90609
  _initEvent() {
90649
90610
  var _a;
@@ -98701,22 +98662,26 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98701
98662
  };
98702
98663
  const getHorizontalPositionType = (position, defaultCase) => { var _a, _b; return (_b = (_a = positionType[position]) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : defaultCase; };
98703
98664
  const getVerticalPositionType = (position, defaultCase) => { var _a, _b; return (_b = (_a = positionType[position]) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : defaultCase; };
98704
- const getCartesianCrosshairRect = (dimensionInfo, series, layoutStartPoint) => {
98665
+ const getCartesianCrosshairRect = (dimensionData, layoutStartPoint) => {
98666
+ var _a;
98705
98667
  const currValueX = new Map();
98706
98668
  const currValueY = new Map();
98707
- dimensionInfo.forEach(({ axis, value }) => {
98708
- if (['top', 'bottom'].includes(axis.getOrient())) {
98709
- currValueX.set(axis.getSpecIndex(), {
98710
- value,
98711
- axis
98712
- });
98713
- }
98714
- else {
98715
- currValueY.set(axis.getSpecIndex(), {
98716
- value,
98717
- axis
98718
- });
98719
- }
98669
+ const { series, datum } = dimensionData;
98670
+ const isHorizontal = series.direction === "horizontal";
98671
+ const axisHelper = isHorizontal
98672
+ ? series.getYAxisHelper()
98673
+ : series.getXAxisHelper();
98674
+ const axisId = axisHelper.getAxisId();
98675
+ const axis = series
98676
+ .getChart()
98677
+ .getComponentsByKey('axes')
98678
+ .find(axis => axis.id === axisId);
98679
+ if (!axis) {
98680
+ return undefined;
98681
+ }
98682
+ (isHorizontal ? currValueY : currValueX).set(axis.getSpecIndex(), {
98683
+ value: (_a = series.getDatumPositionValues(datum[0], series.getDimensionField())) === null || _a === void 0 ? void 0 : _a[0],
98684
+ axis
98720
98685
  });
98721
98686
  const xHair = {
98722
98687
  visible: !!currValueX.size,
@@ -99030,29 +98995,28 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99030
98995
  return 0;
99031
98996
  };
99032
98997
  this._getActualTooltipPosition = (actualTooltip, params, tooltipBoxSize) => {
99033
- var _a, _b, _c, _d, _e, _f, _g, _h;
99034
- const event = params.event;
98998
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
99035
98999
  const { tooltipSpec } = params;
99036
- const firstDimensionInfo = (_a = params.dimensionInfo) === null || _a === void 0 ? void 0 : _a[0];
99037
99000
  const invalidPosition = {
99038
99001
  x: Infinity,
99039
99002
  y: Infinity
99040
99003
  };
99041
- let { offsetX, offsetY } = this._option;
99042
99004
  if (!tooltipSpec) {
99043
99005
  this._cacheTooltipPosition = undefined;
99044
99006
  return invalidPosition;
99045
99007
  }
99008
+ const event = params.event;
99046
99009
  const { activeType, data } = actualTooltip;
99047
- const pattern = tooltipSpec[activeType];
99048
- const position = getTooltipPatternValue(pattern.position, data, params);
99049
- const positionMode = (_b = getTooltipPatternValue(pattern.positionMode, data, params)) !== null && _b !== void 0 ? _b : (activeType === 'mark' ? 'mark' : 'pointer');
99050
- const tooltipParentElement = this._getParentElement(tooltipSpec);
99010
+ const firstDim = activeType === 'dimension' ? (_b = (_a = data[0]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0] : data === null || data === void 0 ? void 0 : data[0];
99011
+ let { offsetX, offsetY } = this._option;
99012
+ const spec = tooltipSpec[activeType];
99013
+ const position = getTooltipPatternValue(spec.position, data, params);
99014
+ const positionMode = (_c = getTooltipPatternValue(spec.positionMode, data, params)) !== null && _c !== void 0 ? _c : (activeType === 'mark' ? 'mark' : 'pointer');
99051
99015
  const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = tooltipBoxSize !== null && tooltipBoxSize !== void 0 ? tooltipBoxSize : {};
99052
99016
  const isCanvas = tooltipSpec.renderMode === 'canvas';
99053
- const canvasRect = (_c = params === null || params === void 0 ? void 0 : params.chart) === null || _c === void 0 ? void 0 : _c.getCanvasRect();
99054
- const canvasWidth = (_d = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.width) !== null && _d !== void 0 ? _d : DEFAULT_CHART_WIDTH;
99055
- const canvasHeight = (_e = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.height) !== null && _e !== void 0 ? _e : DEFAULT_CHART_HEIGHT;
99017
+ const canvasRect = (_d = params === null || params === void 0 ? void 0 : params.chart) === null || _d === void 0 ? void 0 : _d.getCanvasRect();
99018
+ const canvasWidth = (_e = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.width) !== null && _e !== void 0 ? _e : DEFAULT_CHART_WIDTH;
99019
+ const canvasHeight = (_f = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.height) !== null && _f !== void 0 ? _f : DEFAULT_CHART_HEIGHT;
99056
99020
  let isFixedPosition = false;
99057
99021
  const containerSize = {
99058
99022
  width: 0,
@@ -99066,8 +99030,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99066
99030
  containerSize.width = window.innerWidth;
99067
99031
  containerSize.height = window.innerHeight;
99068
99032
  if (!isCanvas) {
99069
- tooltipParentElementRect = (_g = (_f = tooltipParentElement === null || tooltipParentElement === void 0 ? void 0 : tooltipParentElement.getBoundingClientRect) === null || _f === void 0 ? void 0 : _f.call(tooltipParentElement)) !== null && _g !== void 0 ? _g : invalidPosition;
99070
- const chartElement = ((_h = this._compiler.getCanvas()) !== null && _h !== void 0 ? _h : this._chartContainer);
99033
+ const tooltipParentElement = this._getParentElement(tooltipSpec);
99034
+ tooltipParentElementRect = (_h = (_g = tooltipParentElement === null || tooltipParentElement === void 0 ? void 0 : tooltipParentElement.getBoundingClientRect) === null || _g === void 0 ? void 0 : _g.call(tooltipParentElement)) !== null && _h !== void 0 ? _h : invalidPosition;
99035
+ const chartElement = ((_j = this._compiler.getCanvas()) !== null && _j !== void 0 ? _j : this._chartContainer);
99071
99036
  const chartElementRect = chartElement === null || chartElement === void 0 ? void 0 : chartElement.getBoundingClientRect();
99072
99037
  relativePosOffset = {
99073
99038
  x: chartElementRect.x - tooltipParentElementRect.x,
@@ -99104,9 +99069,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99104
99069
  x2 = bounds.x2 + startPoint.x;
99105
99070
  }
99106
99071
  }
99107
- else if (mode === 'crosshair' && ((_a = firstDimensionInfo === null || firstDimensionInfo === void 0 ? void 0 : firstDimensionInfo.axis) === null || _a === void 0 ? void 0 : _a.getCoordinateType()) === 'cartesian') {
99072
+ else if (mode === 'crosshair' &&
99073
+ ((_a = firstDim === null || firstDim === void 0 ? void 0 : firstDim.series) === null || _a === void 0 ? void 0 : _a.coordinate) === 'cartesian' &&
99074
+ firstDim.datum &&
99075
+ firstDim.datum.length) {
99108
99076
  isFixedPosition = true;
99109
- const rect = getCartesianCrosshairRect(params.dimensionInfo, getFirstSeries(this._component.getRegions(), 'cartesian'), startPoint);
99077
+ const rect = getCartesianCrosshairRect(firstDim, startPoint);
99110
99078
  if (rect) {
99111
99079
  x1 = rect.start.x;
99112
99080
  x2 = rect.end.x;
@@ -99151,9 +99119,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99151
99119
  y2 = bounds.y2 + startPoint.y;
99152
99120
  }
99153
99121
  }
99154
- else if (mode === 'crosshair' && ((_a = firstDimensionInfo === null || firstDimensionInfo === void 0 ? void 0 : firstDimensionInfo.axis) === null || _a === void 0 ? void 0 : _a.getCoordinateType()) === 'cartesian') {
99122
+ else if (mode === 'crosshair' &&
99123
+ ((_a = firstDim === null || firstDim === void 0 ? void 0 : firstDim.series) === null || _a === void 0 ? void 0 : _a.coordinate) === 'cartesian' &&
99124
+ firstDim.datum &&
99125
+ firstDim.datum.length) {
99155
99126
  isFixedPosition = true;
99156
- const rect = getCartesianCrosshairRect(params.dimensionInfo, getFirstSeries(this._component.getRegions(), 'cartesian'), startPoint);
99127
+ const rect = getCartesianCrosshairRect(firstDim, startPoint);
99157
99128
  if (rect) {
99158
99129
  y1 = rect.start.y;
99159
99130
  y2 = rect.end.y;
@@ -99350,49 +99321,23 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99350
99321
  y = (containerHeight - tooltipParentElementRect.y) / tooltipParentElementScale - tooltipBoxHeight;
99351
99322
  }
99352
99323
  };
99353
- switch (getHorizontalPositionType(position, 'right')) {
99354
- case 'center':
99355
- case 'centerLeft':
99356
- case 'centerRight':
99357
- if (isLeftOut()) {
99358
- detectLeftFirst();
99359
- detectRightLast();
99360
- }
99361
- else {
99362
- detectRightFirst();
99363
- detectLeftLast();
99364
- }
99365
- break;
99366
- case 'left':
99367
- detectLeftFirst();
99368
- detectRightLast();
99369
- break;
99370
- case 'right':
99371
- detectRightFirst();
99372
- detectLeftLast();
99373
- break;
99324
+ const horizontalType = getHorizontalPositionType(position, 'right');
99325
+ if (horizontalType === 'left' || (horizontalType.includes('center') && isLeftOut())) {
99326
+ detectLeftFirst();
99327
+ detectRightLast();
99374
99328
  }
99375
- switch (getVerticalPositionType(position, 'bottom')) {
99376
- case 'center':
99377
- case 'centerTop':
99378
- case 'centerBottom':
99379
- if (isTopOut()) {
99380
- detectTopFirst();
99381
- detectBottomLast();
99382
- }
99383
- else {
99384
- detectBottomFirst();
99385
- detectTopLast();
99386
- }
99387
- break;
99388
- case 'top':
99389
- detectTopFirst();
99390
- detectBottomLast();
99391
- break;
99392
- case 'bottom':
99393
- detectBottomFirst();
99394
- detectTopLast();
99395
- break;
99329
+ else {
99330
+ detectRightFirst();
99331
+ detectLeftLast();
99332
+ }
99333
+ const verticalType = getVerticalPositionType(position, 'bottom');
99334
+ if (verticalType === 'top' || (verticalType.includes('center') && isTopOut())) {
99335
+ detectTopFirst();
99336
+ detectBottomLast();
99337
+ }
99338
+ else {
99339
+ detectBottomFirst();
99340
+ detectTopLast();
99396
99341
  }
99397
99342
  const result = { x, y };
99398
99343
  this._cacheTooltipPosition = result;