fix(dom): update canvas style on resize to allow chart to grow by jonathan-fulton · Pull Request #12188 · chartjs/Chart.js
Summary
Fixes #12177
When a chart's container grows (e.g., window resize making the container larger), the canvas would not grow to fill the new space. The canvas style dimensions were only set initially but not updated on subsequent resizes.
Changes
- Enhanced
retinaScalefunction inhelpers.dom.tsto update the canvas style dimensions during resize if they were previously set by Chart.js - This ensures the canvas can grow when its container grows, not just shrink
Technical Details
The fix checks if the current style dimensions differ from the chart dimensions and updates them accordingly. This maintains the behavior where Chart.js-managed styles are kept in sync with the actual chart size.