100pah commented on a change in pull request #14995:
URL: https://github.com/apache/echarts/pull/14995#discussion_r661584146
##########
File path: src/component/axisPointer/axisTrigger.ts
##########
@@ -298,16 +298,16 @@ function buildPayloadsBySeries(value: AxisValue,
axisInfo: CollectedAxisInfo) {
if (dist < minDist || (diff >= 0 && minDiff < 0)) {
minDist = dist;
minDiff = diff;
- snapToValue = seriesNestestValue;
+ snapToValue = axisInfo.snap ? seriesNestestValue : value;
Review comment:
This change seem do not resolve the issue. The effect does not change.
And this method should return a `snapToValue` whether `axisInfo.snap` is
`true` or `false`, so I think the `snapToValue` should not be assigned by
`value` here.
##########
File path: src/component/axisPointer/axisTrigger.ts
##########
@@ -298,16 +298,16 @@ function buildPayloadsBySeries(value: AxisValue,
axisInfo: CollectedAxisInfo) {
if (dist < minDist || (diff >= 0 && minDiff < 0)) {
minDist = dist;
minDiff = diff;
- snapToValue = seriesNestestValue;
+ snapToValue = axisInfo.snap ? seriesNestestValue : value;
Review comment:
The reason we can see
<https://github.com/apache/echarts/blob/master/src/component/axisPointer/axisTrigger.ts#L254>.
The comment above that line is not good enough to describe to what will
happen. I think the comment could be changed to:
```js
// When mouse is on the middle of two points, if tooltip showing, the
content
// of the tooltip will either the data of pointA or pointB. So when the
// `axis value` is displayed in tooltip, it should either be `axis value`
// of pointA or `axis value` of pointB, rather than the middle value.
// That is, the `axis value` in tooltip content should always use
`snapToValue`.
// Otherwise it will mislead users.
```
--
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]