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

Avoid zooming in when zooming out over certain areas of chart #574

Merged
merged 2 commits into from
Sep 20, 2021

Conversation

0b10011
Copy link
Contributor

@0b10011 0b10011 commented Jul 28, 2021

Zooming out when hovering over y-axis labels or legend (position: "right") would cause minPercent to be negative or past 100%, causing the chart to zoom in instead.

Reproduced with a line chart using dates for the x axis. Plugin settings:

{
    zoom: {
        pan: {
            enabled: true,
            mode: "x"
        },
        limits: {
            x: {
                min: "original",
                max: "original",
                minRange: 7 * 24 * 60 * 60 * 1000
            }
        },
        zoom: {
            wheel: {
                enabled: true,
            },
            pinch: {
                enabled: true
            },
            mode: 'x'
        }
    }
}

Zooming out when hovering over y-axis labels or legend would cause `minPercent` to be negative or past 100%, causing the chart to zoom in instead.
Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is fine, just very verbose in my opinion.

src/scale.types.js Outdated Show resolved Hide resolved
@kurkle kurkle added this to the 1.2.0 milestone Sep 17, 2021
@kurkle kurkle added the bug label Sep 17, 2021
@kurkle kurkle merged commit cf1966d into chartjs:master Sep 20, 2021
@0b10011 0b10011 deleted the patch-1 branch September 20, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants