Skip to content

Zooming a log axis aggregates with log10 values as data bounds #74

Closed

Description

@jvdd

Problem

On a log axis, Plotly reports the viewport in log10 units: a visible range of 10 to 100 is [1, 2]. handleRelayout (flexviz/adapters/js/plotly/events.js) stores these numbers in state.viewport unchanged, and the engine uses them as data bounds. Every trace that re-aggregates on that axis (line x, histogram data axis, histogram2d) then aggregates the wrong range.

Reproduction

Public API only:

dash = Dashboard(pl.DataFrame({"ts": np.arange(1, 10_001), "val": np.sin(np.arange(10_000) / 300)}))
fig = dash.add_figure()
fig.add_line(x="ts", y="val", n_points=500)
fig.update_layout(xaxis={"type": "log"})

Drag-zoom the x axis. Measured on main (2026-09-23):

  • Plotly shows 15.8 to 249.5.
  • state.viewport stores {min: 1.20, max: 2.40}, and the viewport event sends the same.
  • The server returns one point (x = 2).

Fix direction

Convert at the viewport boundary: store data units when a gesture writes state.viewport on a log axis (10 ** v), and convert back to log10 when syncLayoutViewport writes the layout. Add a browser regression test with a real drag on a log axis.

Linked axes (Dashboard.link_axes) reject log axes until this is fixed.

Activity

  1. added
    bug
    on Sep 23, 2026
  2. jvdd commented on Sep 29, 2026

    @jvdd
    ContributorAuthor

    Fixed by #113.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions