Skip to content

Commit

Permalink
fix(tooltip): Changing tooltip config doesn't refresh the displayed t…
Browse files Browse the repository at this point in the history
…ooltip
  • Loading branch information
Justin-ZS committed Mar 10, 2025
1 parent 18f0316 commit d6b12d2
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/component/tooltip/TooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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') {
api.dispatchAction({
type: 'updateAxisPointer',
x: payload.x,
y: payload.y
});
}

this._tryShow({
offsetX: payload.x,
Expand Down
1 change: 1 addition & 0 deletions test/runTest/actions/__meta__.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/runTest/actions/tooltip-refresh.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 120 additions & 0 deletions test/tooltip-refresh.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d6b12d2

Please sign in to comment.