chartjs / chartjs/Chart.js

Resposive chart infinitely shrinking with certain zoom levels

Open
#11,612 7 comments 3 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

Responsive chart should be a stable size with all devicePixelRatios.

### Current behavior

Chart will infinitely shrink when certain devicePixelRatios are used.

Behavior occurs with a devicePixelRatio of 1.3499999046325684.

The ratio can be achieved naturally by users:

Windows 10
Screen resolution: 1920x1080
Windows resolution scaling: 150%
Chrome zoom level: 90%

### Reproducible sample

https://codesandbox.io/p/sandbox/chartjs-responsive-zoom-thccwr

### Optional extra steps/info to reproduce

Demo uses css `zoom` property. Need to use a browser that supports `zoom`, such as Chrome.

### Possible solution

_No response_

### Context

I believe this is the same issue as https://github.com/chartjs/Chart.js/issues/10890.

Either the issue was reintroduced or the original fix didn't work for all scenarios.

### chart.js version

4.4.1

### Browser name and version

Chrome 119

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.