Use round when setting new chart size (#7221)

This commit is contained in:
emmcbd 2020-03-28 00:46:34 +01:00 committed by GitHub
parent 60858547ac
commit 8b01ab1326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,8 +313,8 @@ export default class Chart {
// the canvas display style uses the same integer values to avoid blurring effect.
// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collapsed
const newWidth = Math.max(0, Math.floor(width));
const newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : height));
const newWidth = Math.max(0, Math.round(width));
const newHeight = Math.max(0, Math.round(aspectRatio ? newWidth / aspectRatio : height));
// detect devicePixelRation changes
const oldRatio = me.currentDevicePixelRatio;