Repository navigation
Use integer canvas dimensions - #12142
Merged
Merged
Conversation
As a result of chartjs#12097, the HTMLCanvasElement's `width` and `height` (which are always integers - see [MDN][1]) may be compared to fractional `deviceWidth` and `deviceHeight`, resulting in extra resize and update events being fired. This PR rounds the dimensions for purposes of comparing to the canvas element's, which should put the behavior closer to Chart.js 4.5.0 and earlier. I've tested this against chartjs#11224, my own code (which was generating errors due to an interaction between these extra events and some internal plugins), and https://codepen.io/joshkel/pen/azdjLGZ, and it seems to work. [1]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#instance_properties
etimberg
approved these changes
Oct 28, 2025
LeeLenaleee
approved these changes
Nov 16, 2025
2 of 3 tasks
pika-02-03
added a commit
to Open-Chat-Graph/Open-Chat-Graph
that referenced
this pull request
Feb 23, 2026
Chart.js 4.5.1の既知のリグレッション(chartjs/Chart.js#12143)により、 キャンバスが小数ピクセル幅を持つ場合に余分なresizeイベントが発生し、 onResizeコールバック内のchart.resize()と連鎖して無限ループが発生する。 また初回レンダー時の余分なリサイズにより起動アニメーションも消失する。 修正PR(chartjs/Chart.js#12142)が未リリースのため4.4.7に固定して回避。 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Merged
1 of 2 tasks
pika-02-03
added a commit
to Open-Chat-Graph/Open-Chat-Graph
that referenced
this pull request
Jun 10, 2026
Chart.js 4.5.1の既知のリグレッション(chartjs/Chart.js#12143)により、 キャンバスが小数ピクセル幅を持つ場合に余分なresizeイベントが発生し、 onResizeコールバック内のchart.resize()と連鎖して無限ループが発生する。 また初回レンダー時の余分なリサイズにより起動アニメーションも消失する。 修正PR(chartjs/Chart.js#12142)が未リリースのため4.4.7に固定して回避。 Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Is this ever going to be released? |
1 task
1 task
ErkoRisthein
added a commit
to TulevaEE/onboarding-client
that referenced
this pull request
Oct 25, 2026
… stale width and soft chart.js 4.5.1 sizes the canvas with fractional CSS pixels over a whole-pixel bitmap. On desktop widths the tax-win and growth charts then ignore the first resize after loading, so the growth bar runs into its legend and the tax-win chart leaves an empty strip, and all four calculator charts draw slightly blurred and skip their entry animation. 4.6.0 switches back to integer canvas dimensions (chartjs/Chart.js#12142), so it can replace this hold once it has been checked against these pages.
ErkoRisthein
added a commit
to TulevaEE/onboarding-client
that referenced
this pull request
Nov 3, 2026
… stale width and soft chart.js 4.5.1 sizes the canvas with fractional CSS pixels over a whole-pixel bitmap. On desktop widths the tax-win and growth charts then ignore the first resize after loading, so the growth bar runs into its legend and the tax-win chart leaves an empty strip, and all four calculator charts draw slightly blurred and skip their entry animation. 4.6.0 switches back to integer canvas dimensions (chartjs/Chart.js#12142), so it can replace this hold once it has been checked against these pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As a result of #12097, the HTMLCanvasElement's
widthandheight(which are always integers - see MDN) may be compared to fractionaldeviceWidthanddeviceHeight, resulting in extra resize and update events being fired.This PR rounds the dimensions for purposes of comparing to the canvas element's, which should put the behavior closer to Chart.js 4.5.0 and earlier.
I've tested this against #11224, my own code (which was generating errors due to an interaction between these extra events and some internal plugins), and https://codepen.io/joshkel/pen/azdjLGZ, and it seems to work.
Fixes #12143