Skip to content
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

Hover over filled area: incorrect text #2399

Closed
gv-collibris opened this issue Apr 21, 2020 · 7 comments
Closed

Hover over filled area: incorrect text #2399

gv-collibris opened this issue Apr 21, 2020 · 7 comments

Comments

@gv-collibris
Copy link

I'm trying to build a stacked area chart, starting from the example provided here.

However, the hover text does not always match the hovered area. In the following screen shot, I'm actually over the blue area, close to y = 0.
image

I'm using the following code to plot online (the aim is to use this in a Dash application).

import plotly.graph_objects as go

fig = go.Figure()
for i, y in enumerate([0, 1]):
    values=[i, 1 + i, 2 + i, 1 + i, i]
    fig.add_trace(go.Scatter(x=[0, 1, 2, 3, 4], y=values,
                             stackgroup="one",
                             hoveron = 'points+fills', # select where hover is active
                             name=f"Trace {y}",
                             text=[f"<span>Value: {v}</span>" for v in values],
                             hoverinfo = 'text+x'))
fig.update_layout(
    title = "hover on <i>points</i> or <i>fill</i>",
)

Also, with the same setting, the label is wrong : withhoverinfo='text+x', the text in the hover is the name of the trace. Note that the hovers on the markers are correct.

@meakbiyik
Copy link

I second to this. Hover markers simply do not show the correct label, especially when there are many stacked zero areas on top of each other.

@nicolaskruchten
Copy link
Contributor

Today, hovering on areas gives very limited information: just the trace name. This isn't a bug so much as an incompletely-implemented feature :)

@meakbiyik
Copy link

meakbiyik commented May 5, 2020

Sample-72-Subtype-3-Jupyter-Note

@nicolaskruchten if this behavior is not a bug, I do not know what is. The hover info is far from stable, and it usually misses the line or area that I want. First I thought it was related to plotly/plotly.js#2165, but the error persists even without fills parameter.

P.S. here's the code snippet. I know that some variables are missing (I can't provide the whole code), but the idea should be there.

fig_ud = go.Figure()
fill = 'tozeroy'
for key, group in melted_df.groupby('Delay type'):
    fig_ud.add_trace(
        go.Scatter(x = group['timestamp'], y = group['Sample count'],
                         fill=fill, name = key, stackgroup = 'x',
                         mode='none')
    )
    fill = 'tonexty'

@nicolaskruchten
Copy link
Contributor

Ah, I see. I was referring to the contents of the hover-label, and confirming that indeed when hovering on fills, you only get to see the trace name and this is by design today.

If you're seeing issues where the wrong hover-label is showing up, this is probably something that we need to bring up in the Plotly.js repo. I'll try to pull together a minimal JS-only CodePen.

@bambinobino
Copy link

I am having the same issue, has there been any update on this?

@warren-oneill
Copy link

a workaround could be to use fig.update_layout(hovermode='x unified')

@gvwilson
Copy link
Contributor

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants