You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They would like some type of event be fired when hovering over lines instead of just points:
I would also like to raise an appeal for maps of lines being treated as actual lines rather than collections of points. It seems like the callbacks are only firing above the component points, rather than over the line itself, which is confusing to an end user.
Yeah, makes sense, I can certainly see wanting this, and it would be nice to couple it with a line highlighting mode (where all other line traces fade out when you hover on one line). Relevant to all the scatter types in fact.
It'll be a bit tricky to figure out how this should work:
What data do you report (both endpoints of the segment? the exact nearest-point-on-the-line?)
Is it the same event type or a different event type from regular plotly_hover?
Do you fire a point-hover AND a line-hover event when you're over a point?
OP Here, I'm somewhat familiar with the mechanics of geometry creation in leaflet and mapbox, less clear on what's happening under the hood with plotly.
Could "scatterlines" just behave as lines for the most part? If a plot creator wants functionality related to the points on the line, then they could add the same dataset as points and control point events separately. That's how leaflet would treat the objects.
Could "scatterlines" just behave as lines for the most part?
The reason these are all lumped under one trace type is lines, points, point text, and fills are all independently togglable elements - so I suspect by default we're always going to want them to be treated identically. And for backward compatibility I don't think we can change that until v2 anyway.
But in my first comment I had forgotten that we already implemented something similar with hoveron: 'fills' in #673 - seems like the right approach will be to add 'lines' as another option to hoveron, which will help answer some of my questions above.
I was wondering if there has been any progress on this, with v2 out for a long time and 6 years since reporting?
Just trying it out it seems no events fire on the lines, only on the "data points". When covering those with another marker layer there is no access to the lines at all without filtering through legends.
@mydoghasfleas we haven't been able to put any resources against it, but if someone from the community would like to submit a PR, I would be happy to prioritize review. cheers - @gvwilson
Activity
alexcjohnson commentedon Aug 17, 2017
Yeah, makes sense, I can certainly see wanting this, and it would be nice to couple it with a line highlighting mode (where all other line traces fade out when you hover on one line). Relevant to all the scatter types in fact.
It'll be a bit tricky to figure out how this should work:
plotly_hover?radumas commentedon Aug 17, 2017
OP Here, I'm somewhat familiar with the mechanics of geometry creation in leaflet and mapbox, less clear on what's happening under the hood with plotly.
Could "scatterlines" just behave as lines for the most part? If a plot creator wants functionality related to the points on the line, then they could add the same dataset as points and control point events separately. That's how leaflet would treat the objects.
alexcjohnson commentedon Aug 17, 2017
The reason these are all lumped under one trace type is lines, points, point text, and fills are all independently togglable elements - so I suspect by default we're always going to want them to be treated identically. And for backward compatibility I don't think we can change that until v2 anyway.
But in my first comment I had forgotten that we already implemented something similar with
hoveron: 'fills'in #673 - seems like the right approach will be to add'lines'as another option tohoveron, which will help answer some of my questions above.ievgennaida commentedon Dec 14, 2020
I would like to have an option to detect click on line, not even a data point on a line...
Yelinz commentedon Oct 30, 2023
I was wondering if there has been any progress on this, with v2 out for a long time and 6 years since reporting?
Just trying it out it seems no events fire on the lines, only on the "data points". When covering those with another marker layer there is no access to the lines at all without filtering through legends.
mydoghasfleas commentedon Jun 5, 2025
Hi, is this request anywhere close to becoming a reality?
gvwilson commentedon Jun 10, 2025
@mydoghasfleas we haven't been able to put any resources against it, but if someone from the community would like to submit a PR, I would be happy to prioritize review. cheers - @gvwilson