-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
When JavaScript resizes the canvas of a responsive chart to the canvas's relatively sized container, this will cause the container to be resized as well which will, in turn, trigger another canvas resizing and create an infinite loop where the chart will grow indefinitely (at least vertically).
Expected Behavior
The canvas fits the container without expanding it
Current Behavior
Canvas and its container grow indefinitely: https://codepen.io/bugmenot/pen/EdBogW
Possible Solution
Set the canvas's box-sizing to border-boxl. This will include borders/padding in the new canvas size and prevent the canvas from resizing the container: https://codepen.io/bugmenot/pen/oarqGz
Steps to Reproduce
Adopt the example from http://www.chartjs.org/docs/latest/general/responsive.html#important-note simply changing viewport units to percentages
Context
I'm actually trying to isolate another problem. This one I've just encountered trying to create a test case forking the example mentioned above.
Environment
- Chart.js version: 2.5.0, reproducible in 2.7.3
- Browser name and version: Firefox Quantum 62.0.3 (64-bit)