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

Feature Request: add ability to limit upper and lower bounds of min an max scale values independently #768

Open
10man opened this issue Jun 12, 2023 · 3 comments

Comments

@10man
Copy link

10man commented Jun 12, 2023

Hello,

First off, thanks for the plugin, super awesome. 🎩
I'm using the latest (as of 06-11-23) from cdn.jsdelivr for both chart.js and the plugin.

The idea here is to fix (or limit) an axis value and have the zoom affect the data scale in a separately controllable fashion. For example; say we have a dataset that extends away from 0 and we want to zoom keeping 0 in view.

Currently we have:

limits: {
    y: {
        min: 'original'|value,
        max: 'original'|value',
        minRange: value
    }
}

I purpose the following:

limits: {
    y: {
        min: 'original'|value,
        max: 'original'|value,
        minRange: value,
        maxMin: 'original'|value,
        minMax: 'original'|value
    }
}

Where:
minMax sets the maximum value that the min scale could take under zoom.
maxMin sets the minimum value that the max scale could take under zoom.
Setting to original would have the standard implications. Now, if both min and minMax were set to original, that would disable changes to that scale value under zoom.

@10man
Copy link
Author

10man commented Jun 12, 2023

I wouldn't mind doing the work if someone can point me in the right direction. That is, if anyone but me thinks it would be useful...

I took a brief look but I don't know this codebase so I wasn't sure where the bast place to start was. I would offer to do the maxRange #756 update as well if that would help. Seems like that would be in the same area...

@estanglerbm
Copy link

Could you show an example? (I can keep 0 in view by doing a drag zoom, and I can't imagine other examples.)

@kurkle
Copy link
Member

kurkle commented Dec 4, 2024

To me, the proposal (below) seems a bit confusing due to the names.

limits: {
    y: {
        min: 'original'|value,
        max: 'original'|value,
        minRange: value,
        maxMin: 'original'|value,
        minMax: 'original'|value
    }
}

How about this instead (with some extensions):

limits: {
    y: {
        min: 'original' | 'locked' | value | { min: value, max: value },
        max: 'original' | 'locked' | value | { min: value, max: value },
        minRange: value,
        maxRange: value,
    }
}

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

No branches or pull requests

3 participants