Skip to content

All chart examples are decreasing in size when pixelRatio is non-terminating value #11224

@omi-key

Description

@omi-key

Expected behavior

When triggering some hover event in a chart, the expected behavior is just to keep the real size.

Current behavior

The charts are shrinking in size, similar to what was reported in #10951.

Reproducible sample

https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html

Optional extra steps/info to reproduce

2023-04-07.02-24-36.mp4

Possible solution

Limiting the value of pixelRatio to discrete values.

Context

On my Xperia 1 II running Chrome, I have noticed that whenever I visit a website that utilizes Chart.js, the charts are consistently shrinking in size. Upon setting "Brake on > attribute modifications" in the Chrome developer tools on the shrinking canvas element, I observed that the values stored in the variables within the retinaScale function are gradually decreasing.

Initially, I suspected a bug in the heatmap graph on Misskey, a recently popular distributed social networking service in Japan. However, I realized that the service was using Chart.js v4.2.1 (after #10971 was merged), which leads me to suspect that the issue lies with Chart.js itself.

chart.js version

v4.2.1

Browser name and version

Google Chrome 111.0.5563.147(Official Build)

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions