Skip to content

fix: hovered tooltip not update when options' series data changed#15194

Merged
pissang merged 4 commits into
apache:masterfrom
ssthouse:fix/tooltip-update-with-options
Jul 16, 2021
Merged

fix: hovered tooltip not update when options' series data changed#15194
pissang merged 4 commits into
apache:masterfrom
ssthouse:fix/tooltip-update-with-options

Conversation

@ssthouse
Copy link
Copy Markdown
Contributor

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fixed issues

#15188

Details

Before: What was the problem?

Originally, when we update the series' data, the shown tooltip will not update until we move the mouse.

After fixing, the tooltip will update, like below:
(the series data changed in the background 2 seconds after tooltip shows)

Jun-19-2021 21-40-17

After: How is it fixed in this PR?

Originally the TooltipView only checks if the series data's size changed, if the user didn't change size but the value in-place, the tooltip will not update.

@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Jun 19, 2021

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Comment thread src/component/tooltip/TooltipView.ts Outdated
Comment thread src/component/tooltip/TooltipView.ts Outdated
Comment thread src/component/tooltip/TooltipView.ts Outdated
Comment thread src/component/tooltip/TooltipView.ts Outdated
@pissang pissang merged commit 9b2d392 into apache:master Jul 16, 2021
@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Jul 16, 2021

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

this._lastDataByCoordSys = dataByCoordSys;
this._cbParamsList = cbParamsList;

return !!contentNotChanged;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!! is not necessary. It must be boolean here.

Comment on lines +959 to +964
lastCbParamsList && zrUtil.each(lastItem.seriesDataIndices, (idxItem) => {
const cbParams = cbParamsList[idxItem.seriesIndex];
if (cbParams && lastCbParamsList[idxItem.seriesIndex].data !== cbParams.data) {
contentNotChanged = false;
}
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The late review is just FYI.

  1. This traversal each looks repeated with the above each (L951-L956). Maybe we can move this logic there as one of the conditions of contentNotChanged.

  2. Assuming 1 is not required, it's better to avoid invoking each if contentNotChanged has been already false and should use for loop rather than each so that we can return once contentNotChanged becomes false.

  3. We should consider the case that seriesData isn't changed but seriesName is changed, in which the tooltip should be also updated.

seriesName change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants