question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hover over filled area: incorrect text

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
nicolaskruchtencommented, May 5, 2020

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.

1reaction
warren-oneillcommented, Mar 31, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hover Text over Fill area - Plotly Python
I have a plot of digital signals. I am trying to shade in certain 'stages' of the process that I am recording.
Read more >
Hover Text over fill area Python plotly - Stack Overflow
I have a plot of digital signals. I am trying to shade in certain 'stages' of the process that I am recording. I...
Read more >
hover - CSS: Cascading Style Sheets - MDN Web Docs
It is generally triggered when the user hovers over an element with the cursor (mouse pointer).
Read more >
How To Create Help Text and Pop-Up Hover Tip ... - YouTube
HOW TO CREATE HELP TEXT AND POP-UP HOVER TIP TEXT IN A FILLABLE FORM IN MS WORD // Learn three ways to insert...
Read more >
Report page tooltips/pop up on hover charts in Power BI in 2 ...
... that lets you create a dashboard/report page when you hover over a data point, this could contain charts, cards tables text boxes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found