jiawulin001 commented on issue #17162: URL: https://github.com/apache/echarts/issues/17162#issuecomment-1156058183
### Conclusion `distance` and `offset` has almost the same function and `offset` works well with any direction. I would suggest use `offset` only and delete `distance` as an API for user. Of course if you want to know why problem exists for `distance`, keep reading. <details> <summary> Problem Location </summary> The place where the position of label is determined is as followed: https://github.com/apache/echarts/blob/11a9247e7fab2e6ff9c60b545ba775e8c1b2412f/src/chart/helper/Line.ts#L449-L454 Here `distanceX/Y` is literally the user-specified `distance` and they are multiplied by `d[0]/d[1]`. `d` is derived here: https://github.com/apache/echarts/blob/11a9247e7fab2e6ff9c60b545ba775e8c1b2412f/src/chart/helper/Line.ts#L365-L366 `toPos` and `fromPos` is the starting point and ending point of the line and `d` means whether they have differences on x or y coordinates. For example, d=[0,1] if the line is parallel to y axis and point at positive direction. Now that explains why `distanceX` won't work at `label.x` because d[0] = 0 and it deactivate the effect of `distanceX`. </details> I would submit a PR to **either delete the `distance` API, or fix `distance` API**. I consider the former one better because these two APIs are functionally replicate. -- 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]
