chartjs / chartjs/Chart.js

Android Specific Width Re-size Bug

Open
#10,878 0 comments 0 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

Chart should go full width of the containing div.

### Current behavior

Chart loads at compressed width.

This only happens on Android. Only seems to happen on my real devices. Note: using Chrome Dev Tools to emulate Android results in correct width.

### Reproducible sample

https://testmy.net/live?chartjsDebug=1

### Optional extra steps/info to reproduce

Screenshots: https://photos.app.goo.gl/qu3FiPB51iBiJyze9

Example where this is happening: https://testmy.net/live (now defaulting to v3.9.1)

I've added a variable you can trigger to load the latest NPM version of chartjs.

On an Android device load https://testmy.net/live?chartjsDebug=1

I tested on a Pixel 5 and S22 Ultra both with the same result (compressed chart width). Testing on iPhone and Emulating Android in Chrome resulted in the expected behavior.

In other instances the chart loads the correct width but when you rotate the screen it gets locked on the smaller size. Again, Android specific, can't replicate in Dev Tools and reverting to v3.9.1 fixes this.

https://testmy.net/hoststats/comcast_cable?chartjsDebug=1

### Possible solution

revert to v3.9.1

### Context

_No response_

### chart.js version

v4.0.1

### Browser name and version

Chrome 107 - Mozilla/5.0 (Linux; Android 13; SM-S908U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36

### Link to your project

https://testmy.net

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.