echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] More control over when line events trigger

Open sjcobb opened this issue 9 months ago • 0 comments

What problem does this feature solve?

Currently, triggerLineEvent is very useful but there are cases where you only want to trigger the event when hovering on the actual line not the area under the curve. This comes up in cases where there are overlapping series with areaStyle set (ex: you want to hover only on the line and have the event trigger for the series you're closest to, disregarding whether it is plotted on top). A workaround for overlapping series is to use zlevel but ideally, we'd have more control over the event.

Example where hovering under the line triggers the mouse event:

https://github.com/user-attachments/assets/6c63496b-bc07-4217-a7e3-7c4629dd32fe

Example where bold series in tooltip does not stay in sync with the correct line being hovered over (using triggerLineEvent: true):

https://github.com/user-attachments/assets/193b4b0d-83cf-4966-b256-4fee721befd7

What does the proposed API look like?

Add a new triggerLineOnlyEvent option to line series. When it is true, only hovering on the actual line will trigger the mouse event.

sjcobb avatar May 27 '25 18:05 sjcobb