Skip to content

[BUG]: Chart flips on panning #7703

Open

Description

@BarnT

Description

If going too far (out of the chart's borders) with the mouse while panning a chart that has maximum range given, the chart flips. See video.

Screenshots/Video

20260205-0943-32.7906029.mp4

Steps to reproduce

Try on jsfiddle: https://jsfiddle.net/ew1o5hv0/12/
Make the window of the example high enough (approx. 2-3 times the height of the chart)
Start grabbing the chart from the middle and go down with the mouse.

Activity

  1. camdecoster commented on Feb 6, 2026

    @camdecoster
    Contributor

    Thanks for the report! @alexcjohnson can you think of any reason why this is the expected behavior?

  2. alexcjohnson commented on Feb 6, 2026

    @alexcjohnson
    Collaborator

    It's certainly not the expected behavior. You should never be able to cause an axis to flip just by dragging, no matter what you drag, be it the middle of the subplot, the middle of an axis, or the end of an axis. But also for a little bit before the axis flips the range gets jittery. You can see this a little bit in the video, it was much more apparent in my testing.

    I think what's happening is when you drag we calculate a new axis range, then we call out to some separate routine to satisfy the minallowed / maxallowed constraints, and that latter routine must run in parts: first it constrains the minimum value to satisfy minallowed, but without constraining the maximum based on minallowed... however now range[1] < range[0] so it decides the axis is reversed, and THEN it applies the constraints again.

    The solution, I think, will be to make the original routine that translates the mouse movement into a new range be aware of these constraints from the beginning, so that it never produces an invalid range that needs to be fixed later. Basically have it switch between double-ended drag (drag the middle of the range) and single-ended drag (drag the end of the range) when we've reached the point that a constraint is applied. There will be some interesting math involved in ensuring the transition between the two is smooth.

    BTW @camdecoster a separate issue. I'm testing this in Safari, and I don't know if this is new or has been that way for a while... but I suspect it's pretty new: I don't see the mouse pointer change to indicate what the drag is going to do, it stays as the default pointer everywhere over the graph except the legend where it changes to the pointing hand. Chrome on my Mac behaves as it should, showing the proper single-ended, double-ended, or 4-way arrow depending on where I am over the plot or axes.

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

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions