Skip to content

Commit d6b12d2

Browse files
committed
fix(tooltip): Changing tooltip config doesn't refresh the displayed tooltip
1 parent 18f0316 commit d6b12d2

File tree

4 files changed

+134
-5
lines changed

4 files changed

+134
-5
lines changed

src/component/tooltip/TooltipView.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ class TooltipView extends ComponentView {
243243
const api = this._api;
244244
const triggerOn = tooltipModel.get('triggerOn');
245245

246+
if (tooltipModel.option.trigger !== 'axis') {
247+
// _lastDataByCoordSys is used for axis tooltip.
248+
this._lastDataByCoordSys = null;
249+
}
250+
246251
// Try to keep the tooltip show when refreshing
247252
if (this._lastX != null
248253
&& this._lastY != null
@@ -365,11 +370,13 @@ class TooltipView extends ComponentView {
365370
else if (payload.x != null && payload.y != null) {
366371
// FIXME
367372
// should wrap dispatchAction like `axisPointer/globalListener` ?
368-
api.dispatchAction({
369-
type: 'updateAxisPointer',
370-
x: payload.x,
371-
y: payload.y
372-
});
373+
if (tooltipModel.option.trigger === 'axis') {
374+
api.dispatchAction({
375+
type: 'updateAxisPointer',
376+
x: payload.x,
377+
y: payload.y
378+
});
379+
}
373380

374381
this._tryShow({
375382
offsetX: payload.x,

test/runTest/actions/__meta__.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/runTest/actions/tooltip-refresh.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/tooltip-refresh.html

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)