Skip to content

Erratic zooming behavior with scrollZoom when changing margins or adding axis labels #4798

Open
@3rd3

Description

@3rd3

The scroll zoom works fine, except when commenting-in the update_layout part. In that case, the zoom oscillates back and forth occasionally. Both Firefox and Chromium are affected. It affects smooth scrolling (trackpad) and line-wise scrolling (external mouse).

Operating system: Windows 11
Plotly version: 5.24.1

import plotly.graph_objs as go
import numpy as np
from plotly.io import to_html

xs = np.random.randn(100)
ys = np.random.randn(100)
trace = go.Scatter(x=xs, y=ys, mode='markers')
fig = go.Figure(data=[trace])
# fig.update_layout(
#   xaxis_title="X Axis",
#   yaxis_title="Y Axis",
#   # margin=dict(l=0, r=0, t=0, b=0),
# )

with open("simple_scatter_plot.html", "w") as f:
  f.write(to_html(fig, config={'scrollZoom': True}))

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions