haoziqaq opened a new pull request, #21801: URL: https://github.com/apache/echarts/pull/21801
<!-- Please fill in the following information to help us review your PR more efficiently. --> ## Brief Information This pull request is in the type of: - [x] bug fixing - [ ] new feature - [ ] others ### What does this PR do? Locates the axis pointer of connected charts by the axis value instead of the hovered chart's `dataIndex`. ### Fixed issues - #20607: Tooltip is not shown on connected chart if y-axis value is `NaN` ## Details ### Before: What was the problem? When a chart in a connected group is hovered, the other charts get `updateAxisPointer` with the hovered chart's `seriesIndex` and `dataIndex`, and look up the point at the same index in their own series. If that point is missing or judged out of the grid, their tooltip and axis pointer are hidden. This happens when the target series: - is `NaN` / `null` at that index (#20607); - is shorter, so the index is out of range; - is at the axis min there, e.g. `0`. The point sits on the bottom edge of the grid, and after the pixel is converted back to the local coordinate it can be slightly out of range (e.g. `-2e-14`), so `containPoint` fails. Whether this happens depends on the grid size. So with several connected time series charts, some show the tooltip and some don't. ### After: How does it behave after the fixing? The event already carries `axesInfo`, the axis value under the pointer, which is what connected charts really have in common. When `x` / `y` are not given, `axisTrigger` now locates the point by that value on the cartesian axis (the other dimension takes the middle of the grid), and skips the pixel check because the value has already passed `axis.containData`. The `seriesIndex` / `dataIndex` lookup is kept as the fallback, e.g. for polar or when no axis value is given. ## Document Info One of the following should be checked. - [x] This PR doesn't relate to document changes - [ ] The document should be updated later - [ ] The document changes have been made in apache/echarts-doc#xxx ## Misc ### Security Checking - [ ] This PR uses security-sensitive Web APIs. <!-- PLEASE CHECK IT AGAINST: <https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors> --> ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs `test/connect-tooltip-axis-value.html` has four connected charts covering the cases above. Click "Hover #40" or hover the first chart: before this change only the first chart shows the tooltip, after it all four do. ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
