You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2024/10/24 07:38:56 UTC
(echarts) 01/01: feat(custom): support disableTooltip for custom series
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch feat-disableTooltip
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit d4ab7dcc26b5abf015120654c5ecec886180d304
Author: Ovilia <zw...@gmail.com>
AuthorDate: Thu Oct 24 15:38:04 2024 +0800
feat(custom): support disableTooltip for custom series
---
src/chart/custom/CustomSeries.ts | 2 ++
src/chart/custom/CustomView.ts | 3 +++
src/component/tooltip/TooltipView.ts | 2 +-
src/util/types.ts | 4 ++++
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/chart/custom/CustomSeries.ts b/src/chart/custom/CustomSeries.ts
index 9f1126056..266621baf 100644
--- a/src/chart/custom/CustomSeries.ts
+++ b/src/chart/custom/CustomSeries.ts
@@ -117,6 +117,8 @@ export interface CustomBaseElementOption extends Partial<Pick<
textContent?: CustomTextOption | false;
// `false` means remove the clipPath
clipPath?: CustomBaseZRPathOption | false;
+ // `false` means not show tooltip
+ disableTooltip?: boolean;
// `extra` can be set in any el option for custom prop for annimation duration.
extra?: Dictionary<unknown> & TransitionOptionMixin;
// updateDuringAnimation
diff --git a/src/chart/custom/CustomView.ts b/src/chart/custom/CustomView.ts
index c0950845b..90f6ad2d1 100644
--- a/src/chart/custom/CustomView.ts
+++ b/src/chart/custom/CustomView.ts
@@ -1041,6 +1041,9 @@ function doCreateOrUpdateEl(
else if ((el as ECElement).disableMorphing) {
(el as ECElement).disableMorphing = false;
}
+ if (elOption.disableTooltip) {
+ (el as ECElement).disableTooltip = true;
+ }
attachedTxInfoTmp.normal.cfg = attachedTxInfoTmp.normal.conOpt =
attachedTxInfoTmp.emphasis.cfg = attachedTxInfoTmp.emphasis.conOpt =
diff --git a/src/component/tooltip/TooltipView.ts b/src/component/tooltip/TooltipView.ts
index d5bf5d8f2..39587cc7a 100644
--- a/src/component/tooltip/TooltipView.ts
+++ b/src/component/tooltip/TooltipView.ts
@@ -450,7 +450,7 @@ class TooltipView extends ComponentView {
const el = e.target;
const tooltipModel = this._tooltipModel;
- if (!tooltipModel) {
+ if (!tooltipModel || el && el.disableTooltip) {
return;
}
diff --git a/src/util/types.ts b/src/util/types.ts
index 1d085c198..08af4a82f 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -137,6 +137,10 @@ export interface ECElement extends Element {
* Force disable morphing
*/
disableMorphing?: boolean
+ /**
+ * Force disable triggering tooltip
+ */
+ disableTooltip?: boolean
}
export interface DataHost {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org