Version
5.4.3
Link to Minimal Reproduction
https://jsfiddle.net/EmmadUsmani/ezh7r6ta/17/
Steps to Reproduce
Mouse over the data points on the "Search Engine" series
Current Behavior
You will see that the circle graphic position at the coordinate returned by chart.convertToPixel
is not where the actual data point is.
Expected Behavior
chart.convertToPixel
should return x and y coordinate values that are accurate to where the data point is rendered, even for a stacked series.
In the reproduction, if you click on the legend to hide the "Email" series, then when you mouseover you will see the circle at the correct position, indicating that chart.convertToPixel
does return the correct value if the series is not stacked on top of another.
Environment
- OS: macOS Ventura 13.5
- Browser: Firefox Developer Edition 119.0b3
- Framework: Vanilla JavaScript
Any additional comments?
No response
1条答案
按热度按时间ztmd8pv51#
chart.convertToPixel should return x and y coordinate values that are accurate to where the data point is rendered, even for a stacked series.
I think your Expected Behavior makes sense. The problem is not with convertToPixel, but the event data.
Mouseover event data will always provide the original line-points values regardless of stacked status.
Please see this Demo based on your code. There is an official ECharts toggle button for stacking and the problem is clearly visible.
Lines are visually stacked, but their internal data structure remains the same.
Is this a bug? Very often developers will reach a point where they think they've done enough and leave the rest (coding) to the users. In this case one could find the stacked line points coordinates by adding their values. Then use convertToPixel to get their true screen positions.
Otherwise, as they say... PRs are always welcome.