Skip to content

A viewport at or below 0 on a log axis: the client shows another range than the server aggregates #121

Open

Description

@jvdd

Problem

After #113, a log axis viewport holds data units. A viewport bound at or below 0 has no log. The client then shows another range than the server aggregates, and nothing reports it.

plotlyRangeFromData (plotly/render.js) writes Math.log10(v) into layout.<axis>.range. For 0 this is -Infinity, and for a negative bound NaN. Plotly replaces the value, while state.viewport keeps the bound and the server aggregates from it.

Reachability

A viewport with a bound at or below 0 on a log axis reaches the client through flexvizApply, a hand-edited spec, or a share URL made from one. No user gesture creates it: a zoom or pan on a log axis always gives bounds above 0. An agent that sets "0 to 100" on a log axis is the likely case.

Reproduction

On fix/log-axis-viewport (#113). A line with x from 1 to 1e6 on a log grid, n_points=100, and update_layout(xaxis={"type": "log"}). Then flexvizApply({state: {viewport: {"<fig>/x": {min: lo, max: 100}}}}):

lo layout.xaxis.range Plotly shows (data units) Viewport sent to the server Data returned
0 [null, 2] 1.58 to 100 {min: 0, max: 100} x = 1 to 100, 96 points
-5 [null, 2] 1.58 to 100 {min: -5, max: 100} x = 1 to 100, 93 points
1 [0, 2] 1 to 100 {min: 1, max: 100} x = 1 to 100, 96 points

For 0 and -5, the points from x = 1 to 1.58 are aggregated but off-screen, and the spec keeps the bound that the display does not show.

Fix direction

Reject the bound where the spec enters, in one place: a model check on DashboardSpec and VisualizationSpec that refuses a viewport bound (and an axis_lock_ranges bound) at or below 0 on an axis declared log. The builder, a share URL, an import and every /dashboard/update request then get the same rule. flexvizApply must report the refusal to its caller.

The check must read the declared type the same way as the client (isLogAxis in plotly/render.js): the axis type, else the type in layout.template.layout.<axis>. _layout_axis in spec.py reads only the axis today, so a log axis declared through a template also passes the link_axes check for log axes.

Related: #74, #98, #113.

Activity

  1. added
    bug
    on Sep 28, 2026
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