You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is one pixel width gap at the right end in an Area chart with a category scale. This doesn't happen with other scale types or in 2.6.0 or earlier.
Either chart.chartArea.left or right is not rounded but getPixelForValue in a category scale returns a rounded value, so that causes one pixel gap between the edge of the filled area and the gridline at the right end.
This can be solved by removing Math.round, and actually #4944 fixed the issue by doing so. My question is if we can completely remove number rounding because it should have been introduced for performance optimization. Since chart.chartArea.left is not rounded currently, it needs to be also rounded if we really want optimization, but that rounding every data point causes the original issue in #4944. So, removing number rounding seems to be the right way.
There is one pixel width gap at the right end in an Area chart with a category scale. This doesn't happen with other scale types or in 2.6.0 or earlier.
Possible Solution
This is caused by the number rounding at
Chart.js/src/scales/scale.category.js
Line 93 in cb14217
Chart.js/src/scales/scale.category.js
Line 102 in cb14217
Either
chart.chartArea.left
orright
is not rounded butgetPixelForValue
in a category scale returns a rounded value, so that causes one pixel gap between the edge of the filled area and the gridline at the right end.This can be solved by removing
Math.round
, and actually #4944 fixed the issue by doing so. My question is if we can completely remove number rounding because it should have been introduced for performance optimization. Sincechart.chartArea.left
is not rounded currently, it needs to be also rounded if we really want optimization, but that rounding every data point causes the original issue in #4944. So, removing number rounding seems to be the right way.Steps to Reproduce
See https://jsfiddle.net/nagix/qo8mxvfp/
Environment
The text was updated successfully, but these errors were encountered: