When the canvas width is smaller than padding left and right, results chartWidth and chartAreaWidth at Chart.js#6221 negative number, causes infinite loop when calculating axis.
|
// Step 1 |
|
var chartWidth = width - leftPadding - rightPadding; |
|
var chartHeight = height - topPadding - bottomPadding; |
|
var chartAreaWidth = chartWidth / 2; // min 50% |
|
var chartAreaHeight = chartHeight / 2; // min 50% |
Solution:
Check width and height are positive or 0 before update the chart.
When the canvas width is smaller than padding left and right, results chartWidth and chartAreaWidth at
Chart.js#6221negative number, causes infinite loop when calculating axis.Chart.js/src/core/core.layoutService.js
Lines 172 to 176 in f9beedb
Solution:
Check width and height are positive or 0 before update the chart.