fix: hovered tooltip not update when options' series data changed#15194
Conversation
|
Thanks for your contribution! |
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
| this._lastDataByCoordSys = dataByCoordSys; | ||
| this._cbParamsList = cbParamsList; | ||
|
|
||
| return !!contentNotChanged; |
There was a problem hiding this comment.
!! is not necessary. It must be boolean here.
| lastCbParamsList && zrUtil.each(lastItem.seriesDataIndices, (idxItem) => { | ||
| const cbParams = cbParamsList[idxItem.seriesIndex]; | ||
| if (cbParams && lastCbParamsList[idxItem.seriesIndex].data !== cbParams.data) { | ||
| contentNotChanged = false; | ||
| } | ||
| }); |
There was a problem hiding this comment.
The late review is just FYI.
-
This traversal
eachlooks repeated with the aboveeach(L951-L956). Maybe we can move this logic there as one of the conditions ofcontentNotChanged. -
Assuming 1 is not required, it's better to avoid invoking
eachifcontentNotChangedhas been alreadyfalseand should useforloop rather thaneachso that we can return oncecontentNotChangedbecomesfalse. -
We should consider the case that
seriesDataisn't changed butseriesNameis changed, in which the tooltip should be also updated.

Brief Information
This pull request is in the type of:
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)
After: How is it fixed in this PR?
Originally the
TooltipViewonly 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.