-
Notifications
You must be signed in to change notification settings - Fork 19.8k
fix(tooltip): Changing tooltip trigger from axis to item doesn't refresh the displayed tooltip #20710
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
base: master
Are you sure you want to change the base?
fix(tooltip): Changing tooltip trigger from axis to item doesn't refresh the displayed tooltip #20710
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,6 +243,11 @@ class TooltipView extends ComponentView { | |
const api = this._api; | ||
const triggerOn = tooltipModel.get('triggerOn'); | ||
|
||
if (tooltipModel.option.trigger !== 'axis') { | ||
// _lastDataByCoordSys is used for axis tooltip. | ||
this._lastDataByCoordSys = null; | ||
} | ||
|
||
// Try to keep the tooltip show when refreshing | ||
if (this._lastX != null | ||
&& this._lastY != null | ||
|
@@ -365,11 +370,13 @@ class TooltipView extends ComponentView { | |
else if (payload.x != null && payload.y != null) { | ||
// FIXME | ||
// should wrap dispatchAction like `axisPointer/globalListener` ? | ||
api.dispatchAction({ | ||
type: 'updateAxisPointer', | ||
x: payload.x, | ||
y: payload.y | ||
}); | ||
if (tooltipModel.option.trigger === 'axis') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why this action should only be dispatched for axis triggers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logically speaking, I don't think whether the This is also one of the reasons why I'm more inclined to think that the issue in this PR isn't a bug. Perhaps keeping the setting of "changing the 'trigger' via setOption won't trigger the redrawing of the tooltip" would simplify matters. May I ask what initially led you to need to fix the problem in this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will revert this change because you think losing the "emphasis" is not a bug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
api.dispatchAction({ | ||
type: 'updateAxisPointer', | ||
x: payload.x, | ||
y: payload.y | ||
}); | ||
} | ||
|
||
this._tryShow({ | ||
offsetX: payload.x, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why we should check if it's axis here? What happens if we don't use this if? Because I don't see other places checking this before setting _lastDataByCoordSys to be null.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_lastDataByCoordSys
is used foraxis
tooltip onlyIf current trigger is still
axis
, it should not be cleared.Other cases to clear the
_lastDataByCoordSys
TooltipView. _tryShow
_showAxisTooltip()
null
)