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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/build/index.js +162 -84
  2. package/build/index.min.js +1 -1
  3. package/cjs/chart/box-plot/box-plot.js +3 -8
  4. package/cjs/chart/box-plot/box-plot.js.map +1 -1
  5. package/cjs/component/tooltip/handler/base.js.map +1 -1
  6. package/cjs/component/tooltip/handler/constants.d.ts +1 -1
  7. package/cjs/component/tooltip/handler/constants.js +2 -2
  8. package/cjs/component/tooltip/handler/constants.js.map +1 -1
  9. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js +2 -1
  10. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  11. package/cjs/component/tooltip/handler/dom/interface.d.ts +3 -0
  12. package/cjs/component/tooltip/handler/dom/interface.js.map +1 -1
  13. package/cjs/component/tooltip/handler/dom/model/content-column-model.d.ts +3 -0
  14. package/cjs/component/tooltip/handler/dom/model/content-column-model.js +34 -33
  15. package/cjs/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  16. package/cjs/component/tooltip/handler/dom/model/interface.d.ts +2 -0
  17. package/cjs/component/tooltip/handler/dom/model/interface.js.map +1 -1
  18. package/cjs/component/tooltip/handler/dom/model/shape-model.d.ts +1 -0
  19. package/cjs/component/tooltip/handler/dom/model/shape-model.js +3 -3
  20. package/cjs/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  21. package/cjs/component/tooltip/handler/dom/model/text-model.d.ts +1 -1
  22. package/cjs/component/tooltip/handler/dom/model/text-model.js +3 -2
  23. package/cjs/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  24. package/cjs/component/tooltip/handler/dom/model/title-model.js +3 -3
  25. package/cjs/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  26. package/cjs/component/tooltip/handler/dom/util.d.ts +1 -0
  27. package/cjs/component/tooltip/handler/dom/util.js +28 -27
  28. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  29. package/cjs/component/tooltip/handler/interface/style.d.ts +10 -7
  30. package/cjs/component/tooltip/handler/interface/style.js.map +1 -1
  31. package/cjs/component/tooltip/handler/utils/attribute.d.ts +9 -2
  32. package/cjs/component/tooltip/handler/utils/attribute.js +58 -9
  33. package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
  34. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  35. package/cjs/component/tooltip/handler/utils/style.d.ts +2 -2
  36. package/cjs/component/tooltip/handler/utils/style.js +5 -2
  37. package/cjs/component/tooltip/handler/utils/style.js.map +1 -1
  38. package/cjs/component/tooltip/interface/theme.d.ts +4 -0
  39. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  40. package/cjs/component/tooltip/tooltip.js +4 -2
  41. package/cjs/component/tooltip/tooltip.js.map +1 -1
  42. package/cjs/component/tooltip/utils/show-tooltip.js +9 -4
  43. package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
  44. package/cjs/constant/scatter.js +1 -2
  45. package/cjs/core/factory.js +2 -1
  46. package/cjs/core/index.d.ts +1 -1
  47. package/cjs/core/index.js +1 -1
  48. package/cjs/core/index.js.map +1 -1
  49. package/cjs/core/instance-manager.d.ts +2 -1
  50. package/cjs/core/instance-manager.js +7 -2
  51. package/cjs/core/instance-manager.js.map +1 -1
  52. package/cjs/core/interface.d.ts +3 -0
  53. package/cjs/core/interface.js.map +1 -1
  54. package/cjs/core/vchart.d.ts +3 -2
  55. package/cjs/core/vchart.js +5 -3
  56. package/cjs/core/vchart.js.map +1 -1
  57. package/cjs/util/text.d.ts +4 -0
  58. package/cjs/util/text.js +9 -1
  59. package/cjs/util/text.js.map +1 -1
  60. package/esm/chart/box-plot/box-plot.js +2 -9
  61. package/esm/chart/box-plot/box-plot.js.map +1 -1
  62. package/esm/component/tooltip/handler/base.js.map +1 -1
  63. package/esm/component/tooltip/handler/constants.d.ts +1 -1
  64. package/esm/component/tooltip/handler/constants.js +1 -1
  65. package/esm/component/tooltip/handler/constants.js.map +1 -1
  66. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js +2 -1
  67. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  68. package/esm/component/tooltip/handler/dom/interface.d.ts +3 -0
  69. package/esm/component/tooltip/handler/dom/interface.js.map +1 -1
  70. package/esm/component/tooltip/handler/dom/model/content-column-model.d.ts +3 -0
  71. package/esm/component/tooltip/handler/dom/model/content-column-model.js +33 -31
  72. package/esm/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  73. package/esm/component/tooltip/handler/dom/model/interface.d.ts +2 -0
  74. package/esm/component/tooltip/handler/dom/model/interface.js.map +1 -1
  75. package/esm/component/tooltip/handler/dom/model/shape-model.d.ts +1 -0
  76. package/esm/component/tooltip/handler/dom/model/shape-model.js +3 -3
  77. package/esm/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  78. package/esm/component/tooltip/handler/dom/model/text-model.d.ts +1 -1
  79. package/esm/component/tooltip/handler/dom/model/text-model.js +3 -2
  80. package/esm/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  81. package/esm/component/tooltip/handler/dom/model/title-model.js +3 -3
  82. package/esm/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  83. package/esm/component/tooltip/handler/dom/util.d.ts +1 -0
  84. package/esm/component/tooltip/handler/dom/util.js +8 -5
  85. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  86. package/esm/component/tooltip/handler/interface/style.d.ts +10 -7
  87. package/esm/component/tooltip/handler/interface/style.js.map +1 -1
  88. package/esm/component/tooltip/handler/utils/attribute.d.ts +9 -2
  89. package/esm/component/tooltip/handler/utils/attribute.js +56 -8
  90. package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
  91. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  92. package/esm/component/tooltip/handler/utils/style.d.ts +2 -2
  93. package/esm/component/tooltip/handler/utils/style.js +5 -2
  94. package/esm/component/tooltip/handler/utils/style.js.map +1 -1
  95. package/esm/component/tooltip/interface/theme.d.ts +4 -0
  96. package/esm/component/tooltip/interface/theme.js.map +1 -1
  97. package/esm/component/tooltip/tooltip.js +5 -1
  98. package/esm/component/tooltip/tooltip.js.map +1 -1
  99. package/esm/component/tooltip/utils/show-tooltip.js +9 -4
  100. package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
  101. package/esm/constant/scatter.js +1 -2
  102. package/esm/core/factory.js +2 -1
  103. package/esm/core/index.d.ts +1 -1
  104. package/esm/core/index.js +1 -1
  105. package/esm/core/index.js.map +1 -1
  106. package/esm/core/instance-manager.d.ts +2 -1
  107. package/esm/core/instance-manager.js +7 -2
  108. package/esm/core/instance-manager.js.map +1 -1
  109. package/esm/core/interface.d.ts +3 -0
  110. package/esm/core/interface.js.map +1 -1
  111. package/esm/core/vchart.d.ts +3 -2
  112. package/esm/core/vchart.js +5 -3
  113. package/esm/core/vchart.js.map +1 -1
  114. package/esm/util/text.d.ts +4 -0
  115. package/esm/util/text.js +7 -1
  116. package/esm/util/text.js.map +1 -1
  117. package/package.json +7 -7
package/build/index.js CHANGED
@@ -33725,7 +33725,10 @@
33725
33725
  let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33726
33726
  if (this.graphicItem) return;
33727
33727
  const attrs = Object.assign({}, attributes);
33728
- this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey), this.graphicItem[BridgeElementKey] = this, this.graphicItem.onBeforeAttributeUpdate = attributes => transformAttributes(this.mark.getAttributeTransforms(), attributes, this), this.graphicItem.setAttributes(this.graphicItem.attribute), this.clearGraphicAttributes(), this.mark.needAnimate() && (this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes(attributes), this.setFinalGraphicAttributes(attributes));
33728
+ this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey), this.graphicItem[BridgeElementKey] = this, this.graphicItem.onBeforeAttributeUpdate = attributes => {
33729
+ if (!this.mark) return attributes;
33730
+ return transformAttributes(this.mark.getAttributeTransforms(), attributes, this);
33731
+ }, this.graphicItem.setAttributes(this.graphicItem.attribute), this.clearGraphicAttributes(), this.mark.needAnimate() && (this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes(attributes), this.setFinalGraphicAttributes(attributes));
33729
33732
  }
33730
33733
  updateGraphicItem(config) {
33731
33734
  var _a;
@@ -33948,10 +33951,8 @@
33948
33951
  this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem = null);
33949
33952
  }
33950
33953
  release() {
33951
- var _a;
33952
- null === (_a = this.mark) || void 0 === _a || _a.animate.getElementAnimators(this).forEach(animator => {
33953
- animator.stop();
33954
- }), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
33954
+ var _a, _b;
33955
+ this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
33955
33956
  }
33956
33957
  getItemAttribute(channel) {
33957
33958
  var _a, _b;
@@ -36479,7 +36480,10 @@
36479
36480
  const glyphMarks = this.glyphMeta.getMarks();
36480
36481
  this.glyphGraphicItems = {}, this.graphicItem.getSubGraphic().forEach(graphic => {
36481
36482
  const markType = glyphMarks[graphic.name];
36482
- this.glyphGraphicItems[graphic.name] = graphic, graphic.onBeforeAttributeUpdate = attributes => transformAttributes(markType, attributes, this, graphic.name);
36483
+ this.glyphGraphicItems[graphic.name] = graphic, graphic.onBeforeAttributeUpdate = attributes => {
36484
+ if (!this.mark) return attributes;
36485
+ return transformAttributes(markType, attributes, this, graphic.name);
36486
+ };
36483
36487
  }), this.clearGraphicAttributes();
36484
36488
  }
36485
36489
  useStates(states, hasAnimation) {
@@ -36533,6 +36537,7 @@
36533
36537
  _onGlyphAttributeUpdate() {
36534
36538
  let first = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
36535
36539
  return attributes => {
36540
+ if (!this.mark) return attributes;
36536
36541
  const glyphMarks = this.glyphMeta.getMarks(),
36537
36542
  graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this),
36538
36543
  defaultEncodeValues = first ? this.encodeDefault() : null,
@@ -49152,8 +49157,14 @@
49152
49157
  static instanceExist(id) {
49153
49158
  return InstanceManager.instances.has(id);
49154
49159
  }
49155
- static forEach(callbackfn, thisArg) {
49156
- return InstanceManager.instances.forEach(callbackfn, thisArg);
49160
+ static forEach(callbackfn, excludeId = [], thisArg) {
49161
+ const excludeIdList = array(excludeId);
49162
+ return InstanceManager.instances.forEach((instance, id, map) => {
49163
+ if (excludeIdList.includes(id)) {
49164
+ return;
49165
+ }
49166
+ callbackfn(instance, id, map);
49167
+ }, thisArg);
49157
49168
  }
49158
49169
  }
49159
49170
 
@@ -49210,6 +49221,11 @@
49210
49221
  ...(option ?? {})
49211
49222
  }, textSpec);
49212
49223
  };
49224
+ const richText = createRichText({});
49225
+ function getRichTextBounds(params) {
49226
+ richText.setAttributes(params);
49227
+ return richText.AABBBounds;
49228
+ }
49213
49229
 
49214
49230
  function mergeFields(targetFields, mergeFields) {
49215
49231
  for (let i = 0; i < mergeFields.length; i++) {
@@ -50900,11 +50916,14 @@
50900
50916
  static getMap(key) {
50901
50917
  return getMapSource(key);
50902
50918
  }
50903
- static hideTooltip() {
50904
- InstanceManager.forEach(instance => instance?.hideTooltip?.());
50919
+ static hideTooltip(excludeId = []) {
50920
+ InstanceManager.forEach(instance => instance?.hideTooltip?.(), excludeId);
50905
50921
  }
50906
50922
  static InstanceManager = InstanceManager;
50907
50923
  static ThemeManager = ThemeManager;
50924
+ static globalConfig = {
50925
+ uniqueTooltip: true
50926
+ };
50908
50927
  _spec;
50909
50928
  _viewBox;
50910
50929
  _chart;
@@ -54112,7 +54131,7 @@
54112
54131
  VChart.useMark([ComponentMark, GroupMark]);
54113
54132
  Factory.registerRegion('region', Region);
54114
54133
  Factory.registerLayout('base', Layout);
54115
- const version = "1.1.0-beta.4";
54134
+ const version = "1.1.0-beta.5";
54116
54135
 
54117
54136
  var SeriesMarkNameEnum;
54118
54137
  (function (SeriesMarkNameEnum) {
@@ -56440,6 +56459,10 @@
56440
56459
  itemMap: new Map()
56441
56460
  };
56442
56461
  tooltipHandler?.showTooltip?.(activeType, mockDimensionInfo, mockParams);
56462
+ const vchart = componentOptions.globalInstance;
56463
+ if (VChart.globalConfig.uniqueTooltip) {
56464
+ VChart.hideTooltip(vchart.id);
56465
+ }
56443
56466
  return activeType;
56444
56467
  }
56445
56468
  else if (activeType === 'mark') {
@@ -56467,6 +56490,10 @@
56467
56490
  series: info.series
56468
56491
  }
56469
56492
  ], mockParams);
56493
+ const vchart = componentOptions.globalInstance;
56494
+ if (VChart.globalConfig.uniqueTooltip) {
56495
+ VChart.hideTooltip(vchart.id);
56496
+ }
56470
56497
  return activeType;
56471
56498
  }
56472
56499
  return 'none';
@@ -74019,7 +74046,7 @@
74019
74046
  outliersField: spec.outliersField,
74020
74047
  outliersStyle: spec.outliersStyle
74021
74048
  };
74022
- seriesSpec[spec.direction === Direction$2.vertical ? 'yField' : 'xField'] = dataFields;
74049
+ seriesSpec[seriesSpec.direction === Direction$2.vertical ? 'yField' : 'xField'] = dataFields;
74023
74050
  return seriesSpec;
74024
74051
  }
74025
74052
  transformSpec(spec) {
@@ -74034,19 +74061,6 @@
74034
74061
  }
74035
74062
  ];
74036
74063
  }
74037
- (spec.axes ?? []).forEach(axis => {
74038
- const { orient, type } = axis;
74039
- if (orient === 'left') {
74040
- if (isNil(type)) {
74041
- axis.type = spec.direction === Direction$2.vertical ? 'linear' : 'band';
74042
- }
74043
- }
74044
- if (orient === 'bottom') {
74045
- if (isNil(type)) {
74046
- axis.type = spec.direction === Direction$2.vertical ? 'band' : 'linear';
74047
- }
74048
- }
74049
- });
74050
74064
  setDefaultCrosshairForCartesianChart(spec);
74051
74065
  }
74052
74066
  }
@@ -83738,6 +83752,24 @@
83738
83752
  }
83739
83753
  }
83740
83754
 
83755
+ const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
83756
+ const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';
83757
+ const TOOLTIP_MAX_LINE_COUNT = 20;
83758
+ const TOOLTIP_EMPTY_STRING = '';
83759
+ const TOOLTIP_OTHERS_LINE = {
83760
+ key: '其他',
83761
+ value: '...'
83762
+ };
83763
+ const DEFAULT_OPTIONS = {
83764
+ offsetX: 10,
83765
+ offsetY: 10,
83766
+ sanitize: escapeHTML
83767
+ };
83768
+ class TooltipHandlerType {
83769
+ static dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
83770
+ static canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
83771
+ }
83772
+
83741
83773
  const getShowContent = (pattern, data, params) => {
83742
83774
  if (!data ||
83743
83775
  params?.event?.type === 'mouseout') {
@@ -84094,9 +84126,13 @@
84094
84126
  const { visible: titleVisible = true, value: titleValue = '', hasShape: titleHasShape, shapeType: titleShapeType = '', shapeHollow: titleShapeHollow, shapeColor: titleShapeColor } = title;
84095
84127
  attribute.title.visible = titleVisible;
84096
84128
  if (titleVisible) {
84097
- const { width, height } = initTextMeasure(titleStyle).quickMeasure(titleValue);
84129
+ const { text, width, height } = measureTooltipText(titleValue, titleStyle);
84098
84130
  attribute.title.value = {
84099
- text: titleValue
84131
+ width,
84132
+ height,
84133
+ text,
84134
+ multiLine: titleStyle.multiLine,
84135
+ wordBreak: titleStyle.wordBreak
84100
84136
  };
84101
84137
  maxWidth = width;
84102
84138
  titleMaxHeight = height;
@@ -84130,16 +84166,18 @@
84130
84166
  const keyWidths = [];
84131
84167
  const adaptiveKeyWidths = [];
84132
84168
  const valueWidths = [];
84133
- const keyTextMeasure = initTextMeasure(keyStyle);
84134
- const valueTextMeasure = initTextMeasure(valueStyle);
84135
84169
  attribute.content = filteredContent.map((item, i) => {
84136
84170
  const itemAttrs = { height: 0, spaceRow };
84137
84171
  let itemHeight = 0;
84138
84172
  const { hasShape, key, shapeColor, shapeHollow, shapeType = '', value, isKeyAdaptive } = item;
84139
84173
  if (isValid(key)) {
84140
- const { width, height } = keyTextMeasure.quickMeasure(key);
84174
+ const { width, height, text } = measureTooltipText(key, keyStyle);
84141
84175
  itemAttrs.key = {
84142
- text: key
84176
+ width,
84177
+ height,
84178
+ text,
84179
+ multiLine: keyStyle.multiLine,
84180
+ wordBreak: titleStyle.wordBreak
84143
84181
  };
84144
84182
  if (!isKeyAdaptive) {
84145
84183
  keyWidths.push(width);
@@ -84150,9 +84188,13 @@
84150
84188
  itemHeight = Math.max(itemHeight, height);
84151
84189
  }
84152
84190
  if (isValid(value)) {
84153
- const { width, height } = valueTextMeasure.quickMeasure(value);
84191
+ const { width, height, text } = measureTooltipText(value, valueStyle);
84154
84192
  itemAttrs.value = {
84155
- text: value
84193
+ width,
84194
+ height,
84195
+ text,
84196
+ multiLine: valueStyle.multiLine,
84197
+ wordBreak: titleStyle.wordBreak
84156
84198
  };
84157
84199
  valueWidths.push(width);
84158
84200
  itemHeight = Math.max(itemHeight, height);
@@ -84200,6 +84242,42 @@
84200
84242
  attribute.panel.height = containerSize.height;
84201
84243
  return attribute;
84202
84244
  };
84245
+ const measureTooltipText = (text, style) => {
84246
+ const measure = initTextMeasure(style);
84247
+ if (!style.multiLine) {
84248
+ const { width, height } = measure.fullMeasure(text);
84249
+ return {
84250
+ width,
84251
+ height,
84252
+ text
84253
+ };
84254
+ }
84255
+ let textLines = text.split('\n');
84256
+ textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\n' : line));
84257
+ const { width, height } = measure.fullMeasure(textLines);
84258
+ if (style.maxWidth && style.maxWidth <= width) {
84259
+ const bound = getRichTextBounds({
84260
+ wordBreak: style.wordBreak,
84261
+ maxWidth: style.maxWidth,
84262
+ width: 0,
84263
+ height: 0,
84264
+ textConfig: textLines.map((line, i) => ({
84265
+ ...style,
84266
+ text: line
84267
+ }))
84268
+ });
84269
+ return {
84270
+ width: bound.width(),
84271
+ height: bound.height(),
84272
+ text: textLines
84273
+ };
84274
+ }
84275
+ return {
84276
+ width,
84277
+ height,
84278
+ text: textLines
84279
+ };
84280
+ };
84203
84281
 
84204
84282
  function getTextAttributes(style = {}, globalTheme) {
84205
84283
  const attrs = {
@@ -84210,29 +84288,14 @@
84210
84288
  fontSize: style.fontSize,
84211
84289
  fontWeight: style.fontWeight,
84212
84290
  lineHeight: style.lineHeight,
84213
- spacing: style.spacing ?? 10
84291
+ spacing: style.spacing ?? 10,
84292
+ multiLine: style.multiLine ?? false,
84293
+ maxWidth: style.maxWidth,
84294
+ wordBreak: style.wordBreak ?? 'break-word'
84214
84295
  };
84215
84296
  return attrs;
84216
84297
  }
84217
84298
 
84218
- const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
84219
- const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';
84220
- const TOOLTIP_MAX_LINE_COUNT = 20;
84221
- const TOOLTIP_EMPTY_STRING = '';
84222
- const TOOLTIP_OTHERS_LINE = {
84223
- key: '其他',
84224
- value: '...'
84225
- };
84226
- const DEFAULT_OPTIONS = {
84227
- offsetX: 10,
84228
- offsetY: 10,
84229
- sanitize: escapeHTML
84230
- };
84231
- class TooltipHandlerType {
84232
- static dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
84233
- static canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
84234
- }
84235
-
84236
84299
  var TooltipResult;
84237
84300
  (function (TooltipResult) {
84238
84301
  TooltipResult[TooltipResult["success"] = 0] = "success";
@@ -84688,7 +84751,7 @@
84688
84751
  if (!labelStyle) {
84689
84752
  return undefined;
84690
84753
  }
84691
- const { fontFamily: labelFont, fontSize: labelFontSize, fill: labelColor, textAlign, lineHeight, fontWeight } = merge$1({}, defaultStyle, labelStyle);
84754
+ const { fontFamily: labelFont, fontSize: labelFontSize, fill: labelColor, textAlign, lineHeight, fontWeight, multiLine, wordBreak, maxWidth } = merge$1({}, defaultStyle, labelStyle);
84692
84755
  const styleObj = {};
84693
84756
  styleObj.fontFamily = labelFont;
84694
84757
  styleObj.fontSize = getPixelPropertyStr(labelFontSize);
@@ -84696,6 +84759,9 @@
84696
84759
  styleObj.textAlign = textAlign;
84697
84760
  styleObj.lineHeight = getPixelPropertyStr(lineHeight);
84698
84761
  styleObj.fontWeight = fontWeight;
84762
+ styleObj.whiteSpace = multiLine ? 'initial' : 'nowrap';
84763
+ styleObj.wordBreak = wordBreak;
84764
+ styleObj.maxWidth = getPixelPropertyStr(maxWidth);
84699
84765
  return styleObj;
84700
84766
  }
84701
84767
  function getShapeStyle(shapeStyle, defaultStyle) {
@@ -84705,7 +84771,6 @@
84705
84771
  const { size } = merge$1({}, defaultStyle, shapeStyle);
84706
84772
  const styleObj = {};
84707
84773
  styleObj.width = getPixelPropertyStr(size);
84708
- styleObj.height = styleObj.width;
84709
84774
  return styleObj;
84710
84775
  }
84711
84776
 
@@ -84894,14 +84959,14 @@
84894
84959
  if (!option?.hasShape || !option.shapeType || !builtinSymbolsMap[option.shapeType]) {
84895
84960
  return '';
84896
84961
  }
84897
- const { shapeType, size, color, hollow = false } = option;
84962
+ const { shapeType, size, color, hollow = false, marginTop = '0px' } = option;
84898
84963
  const path = builtinSymbolsMap[shapeType].pathStr;
84899
84964
  let fill = 'currentColor';
84900
84965
  if (!color || isString(color) || hollow) {
84901
84966
  fill = hollow ? 'none' : color ?? 'currentColor';
84902
84967
  return `
84903
- <svg width="${size}"
84904
- height="${size}" viewBox="-0.5 -0.5 1 1" style="display: inline-block; vertical-align: middle;">
84968
+ <svg width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1"
84969
+ style="display: inline-block; vertical-align: middle; margin-top: ${marginTop};">
84905
84970
  <path fill="${fill}" d="${path}" style="fill: ${fill};">
84906
84971
  </path>
84907
84972
  </svg>`;
@@ -84924,8 +84989,8 @@
84924
84989
  `;
84925
84990
  }
84926
84991
  return `
84927
- <svg width="${size}" height="${size}"
84928
- viewBox="-0.5 -0.5 1 1" style="display: inline-block; vertical-align: middle;">
84992
+ <svg width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1"
84993
+ style="display: inline-block; vertical-align: middle; margin-top: ${marginTop};">
84929
84994
  ${gradient}
84930
84995
  <path fill="url(#${fill})" d="${path}" style="fill: url(#${fill});">
84931
84996
  </path>
@@ -84940,13 +85005,16 @@
84940
85005
  this.product = this.createElement(tag ?? 'span', classList, undefined, id);
84941
85006
  }
84942
85007
  }
84943
- setContent(content) {
85008
+ setContent(content, multiLine) {
84944
85009
  if (!this.product) {
84945
85010
  return;
84946
85011
  }
84947
- const html = this._option.valueToHtml(content);
85012
+ let html = this._option.valueToHtml(content);
85013
+ if (multiLine) {
85014
+ html = html.replaceAll('\n', '<br>');
85015
+ }
84948
85016
  if (html !== this.product.innerHTML) {
84949
- this.product.innerHTML = this._option.valueToHtml(content);
85017
+ this.product.innerHTML = html;
84950
85018
  }
84951
85019
  }
84952
85020
  }
@@ -84997,12 +85065,13 @@
84997
85065
  const tooltipStyle = this._option.getTooltipStyle();
84998
85066
  super.setStyle(merge$1({}, defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));
84999
85067
  const renderContent = this._option.getTooltipActual()?.content ?? [];
85068
+ const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];
85000
85069
  renderContent.forEach((line, i) => {
85001
85070
  let childStyle = {};
85002
85071
  if (this.className === 'key-box') {
85003
85072
  const { key, isKeyAdaptive } = line;
85004
85073
  childStyle = merge$1({}, isKeyAdaptive ? defaultAdaptiveKeyStyle : defaultKeyStyle, {
85005
- height: `${100 / renderContent.length}%`,
85074
+ height: getPixelPropertyStr(contentAttributes[i].height),
85006
85075
  ...tooltipStyle.keyColumn.item
85007
85076
  });
85008
85077
  const hasContent = (isString(key) && key?.trim?.() !== '') || isNumber(key);
@@ -85016,27 +85085,23 @@
85016
85085
  }
85017
85086
  else if (this.className === 'value-box') {
85018
85087
  childStyle = merge$1({}, defaultValueStyle, {
85019
- height: `${100 / renderContent.length}%`,
85088
+ height: getPixelPropertyStr(contentAttributes[i].height),
85020
85089
  ...tooltipStyle.valueColumn.item
85021
85090
  });
85022
85091
  this.children[i].setStyle(childStyle);
85023
85092
  }
85024
85093
  else if (this.className === 'shape-box') {
85025
- childStyle = merge$1({}, defaultShapeStyle, tooltipStyle.shapeColumn.item);
85026
- const childContent = {
85027
- hasShape: line.hasShape,
85028
- shapeType: line.shapeType,
85029
- size: tooltipStyle.shapeColumn.item?.width,
85030
- color: line.shapeColor,
85031
- hollow: line.shapeHollow
85032
- };
85033
- this.children[i]?.setStyle(childStyle, childContent);
85094
+ childStyle = merge$1({}, defaultShapeStyle, {
85095
+ height: getPixelPropertyStr(contentAttributes[i].height),
85096
+ ...tooltipStyle.shapeColumn.item
85097
+ });
85098
+ this.children[i]?.setStyle(childStyle, this._getShapeSvgOption(line));
85034
85099
  }
85035
85100
  });
85036
85101
  }
85037
85102
  setContent() {
85038
- const tooltipStyle = this._option.getTooltipStyle();
85039
85103
  const renderContent = this._option.getTooltipActual()?.content ?? [];
85104
+ const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];
85040
85105
  renderContent.forEach((line, i) => {
85041
85106
  let childContent;
85042
85107
  if (this.className === 'key-box') {
@@ -85047,6 +85112,7 @@
85047
85112
  else {
85048
85113
  childContent = TOOLTIP_EMPTY_STRING;
85049
85114
  }
85115
+ this.children[i]?.setContent(childContent, contentAttributes[i].value?.multiLine);
85050
85116
  }
85051
85117
  else if (this.className === 'value-box') {
85052
85118
  const valueContent = line.value;
@@ -85056,17 +85122,12 @@
85056
85122
  else {
85057
85123
  childContent = TOOLTIP_EMPTY_STRING;
85058
85124
  }
85125
+ this.children[i]?.setContent(childContent, contentAttributes[i].value?.multiLine);
85059
85126
  }
85060
85127
  else if (this.className === 'shape-box') {
85061
- childContent = {
85062
- hasShape: line.hasShape,
85063
- shapeType: line.shapeType,
85064
- size: tooltipStyle.shapeColumn.item?.width,
85065
- color: line.shapeColor,
85066
- hollow: line.shapeHollow
85067
- };
85128
+ childContent = this._getShapeSvgOption(line);
85129
+ this.children[i]?.setContent(childContent);
85068
85130
  }
85069
- this.children[i]?.setContent(childContent);
85070
85131
  });
85071
85132
  }
85072
85133
  _getContentColumnStyle() {
@@ -85086,6 +85147,17 @@
85086
85147
  return tooltipStyle.valueColumn;
85087
85148
  }
85088
85149
  }
85150
+ _getShapeSvgOption(line) {
85151
+ const tooltipStyle = this._option.getTooltipStyle();
85152
+ return {
85153
+ hasShape: line.hasShape,
85154
+ shapeType: line.shapeType,
85155
+ size: tooltipStyle.shapeColumn.item?.width,
85156
+ color: line.shapeColor,
85157
+ hollow: line.shapeHollow,
85158
+ marginTop: `calc((${tooltipStyle.keyColumn.item?.lineHeight ?? tooltipStyle.keyColumn.item?.fontSize ?? '18px'} - ${tooltipStyle.shapeColumn.item?.width ?? '8px'}) / 2)`
85159
+ };
85160
+ }
85089
85161
  }
85090
85162
 
85091
85163
  class ContentModel extends BaseTooltipModel {
@@ -85202,6 +85274,7 @@
85202
85274
  setContent() {
85203
85275
  const tooltipStyle = this._option.getTooltipStyle();
85204
85276
  const tooltipActual = this._option.getTooltipActual();
85277
+ const tooltipAttributes = this._option.getTooltipAttributes();
85205
85278
  const { title } = tooltipActual;
85206
85279
  this.init();
85207
85280
  this.shape?.setStyle(undefined, {
@@ -85211,7 +85284,7 @@
85211
85284
  color: title?.shapeColor,
85212
85285
  hollow: title?.shapeHollow
85213
85286
  });
85214
- this.textSpan?.setContent(title?.value);
85287
+ this.textSpan?.setContent(title?.value, tooltipAttributes.title?.value?.multiLine);
85215
85288
  }
85216
85289
  release() {
85217
85290
  super.release();
@@ -85378,7 +85451,8 @@
85378
85451
  this.model = new TooltipModel(this._container, {
85379
85452
  valueToHtml: this._option.sanitize,
85380
85453
  getTooltipStyle: () => this._domStyle,
85381
- getTooltipActual: () => this._tooltipActual
85454
+ getTooltipActual: () => this._tooltipActual,
85455
+ getTooltipAttributes: () => this._attributeCache
85382
85456
  }, [tooltipSpec.className], this.id);
85383
85457
  }
85384
85458
  }
@@ -85815,6 +85889,10 @@
85815
85889
  this._cacheInfo = tooltipInfo;
85816
85890
  }
85817
85891
  }
85892
+ const vchart = this._option.globalInstance;
85893
+ if (success && VChart.globalConfig.uniqueTooltip) {
85894
+ VChart.hideTooltip(vchart.id);
85895
+ }
85818
85896
  return success;
85819
85897
  };
85820
85898
  _getMouseEventData = (params) => {