Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xy zoom with static y scale cannot be unzoomed/reset #915

Open
leeoniya opened this issue Jan 17, 2024 · 2 comments
Open

xy zoom with static y scale cannot be unzoomed/reset #915

leeoniya opened this issue Jan 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@leeoniya
Copy link
Owner

(followup to #914)

the problem here is a tricky, either we have to disallow y-zoom-in when the y scale range is statically defined, which would be odd / feel broken ux. or we have to return true from sc.auto() when the scale is static but we're viaAutoScaleX = true, which is weird (it means all static scales will scan the data but then pass through the ranging function which will throw the found min/max away). another reason why current auto needs to be split into scan and auto callbacks.

uPlot/src/uPlot.js

Lines 1289 to 1290 in 4b9b927

// or auto scales when the x scale was explicitly set
pendScales[xScaleKey] != null && sc.auto(self, viaAutoScaleX)

Peek.2024-01-17.09-31.mp4

https://jsfiddle.net/vmy4hfq8/

let data = [
    [[], []],
    [[0, 1, 2], [2, 3, 5]],
];

const opts = {
    mode: 2,
    width: 800,
    height: 400,
    scales: {
        x: {
            time: false,
        },
        y: {
            range: [1, 10],
        }
    },
    series: [
        {},
        {
            stroke: "red"
        },
    ],
//    cursor: {
//        y: false,
//        drag: { y: false },
//    }
};

let u = new uPlot(opts, data, document.body);
@leeoniya leeoniya added the bug Something isn't working label Jan 17, 2024
@jint23
Copy link

jint23 commented Feb 7, 2024

We just bumped into this exact same issue. Should the range function be called regardless of auto or not when we're resetting the zoom with double click?

@Clam-
Copy link

Clam- commented Mar 26, 2024

I also just ran into this issue. I'm assuming I need to "remember" my statically set range (already doing this), and reapply it on the resetting zoom event?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants