Skip to content

Hover events on the lines themselves #1960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chriddyp opened this issue Aug 17, 2017 · 5 comments
Open

Hover events on the lines themselves #1960

chriddyp opened this issue Aug 17, 2017 · 5 comments
Labels
feature something new P3 backlog

Comments

@chriddyp
Copy link
Member

A dash community user brought this up https://community.plot.ly/t/linking-scattermapbox-lines-to-other-data-with-callbacks/5449

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.

@alexcjohnson
Copy link
Collaborator

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?
  • What do you do in "compare" hover mode?

@alexcjohnson alexcjohnson added the feature something new label Aug 17, 2017
@radumas
Copy link

radumas commented 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
Copy link
Collaborator

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.

@ievgennaida
Copy link

I would like to have an option to detect click on line, not even a data point on a line...

@Yelinz
Copy link

Yelinz commented 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.

@gvwilson gvwilson self-assigned this Jun 10, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog and removed ♥ NEEDS SPON$OR labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

6 participants