chartjs / chartjs/Chart.js

Chart shrinking uncontrollably on browser zoom

Open
#11,089 61 comments 6 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

I expect the chart canvas to remain an appropriate size when changing the zoom in the browser (Ctrl + Mousewheel).

### Current behavior

The chart initially renders correctly, but then slowly shrinks toward its top-left corner until it disappears, then re-renders at its initial size. This loop repeats indefinitely.

### Reproducible sample

https://codepen.io/leelenaleee/pen/WNyJXEe

### Optional extra steps/info to reproduce

To reproduce, change the browser zoom to 90% (Ctrl + Mousewheel down).
The chart behavior is different at various zoom levels. At 110% zoom, for example, it only shrinks to a certain point and then stops.
Note that this bug is also active on the chart.js documentation site on every chart example.
This bug does not happen in Firefox 109.0 (64-bit), but it does happen in Google Chrome Version 109.0.5414.75 (Official Build) (64-bit).

### Possible solution

_No response_

### Context

_No response_

### chart.js version

v4.2.0

### Browser name and version

Google Chrome Version 109.0.5414.75 (Official Build) (64-bit)

### 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.