Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(custom): support disableTooltip for custom series #20447

Open
wants to merge 1 commit into
base: v6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/chart/custom/CustomSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/chart/custom/CustomView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion src/component/tooltip/TooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class TooltipView extends ComponentView {
const el = e.target;
const tooltipModel = this._tooltipModel;

if (!tooltipModel) {
if (!tooltipModel || el && el.disableTooltip) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export interface ECElement extends Element {
* Force disable morphing
*/
disableMorphing?: boolean
/**
* Force disable triggering tooltip
*/
disableTooltip?: boolean
}

export interface DataHost {
Expand Down