Skip to content

Hover over filled area: incorrect text #2399

Closed
@gv-collibris

Description

@gv-collibris

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions