Skip to content

hovermode="x" is unreliable with multiple traces #5572

Closed
@pfbuxton

Description

@pfbuxton

In a graph which has two traces with a different number of data points and using hovermode="x" it is extremely difficult to "hover" over the trace with the fewer number of data points.

In the example below it is very difficult to hover on the blue trace which has 150 data points, compared to the orange trace which has 1,500 points.
image

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np

app = dash.Dash(__name__)

traces = []

# Make trace with 150 points
x1 = np.linspace(0.0, 1.0, 150)
y1 = np.sin(x1)
traces.append(go.Scatter(
    x = x1,
    y = y1,
    name = '150 data points'
))
# Make data with 1,500 points
x2 = np.linspace(0.0, 1.0, 1500)
y2 = np.cos(x2)
traces.append(go.Scatter(
    x = x2,
    y = y2,
    name = '1,500 data points'
))

app.layout = html.Div(
    children = [
        dcc.Graph(
            figure = dict(data=traces, layout={})
        )
    ],
    style = {
        'width': '500px',
        'height': '600px'
    }
)

if __name__ == '__main__':
    app.run_server(debug=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions