diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 0472bddb31b..8282b3a9425 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -102,7 +102,7 @@ export function _longestText(ctx, font, arrayOfThings, cache) { */ export function _alignPixel(chart, pixel, width) { const devicePixelRatio = chart.currentDevicePixelRatio; - const halfWidth = width / 2; + const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0; return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth; }