-
Notifications
You must be signed in to change notification settings - Fork 12k
fix: Unwanted white gap between bar border and bar fill (chartjs#12094) #12117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LeeLenaleee
commented
Sep 11, 2025
Could you also add a test for this?
... - Added tests in element.bar.tests.js to verify pixel snapping fix
minjibak
commented
Sep 17, 2025
Hi, I added tests for the pixel snapping fix in element.bar.tests.js.
Verifies that bars with a thick borderWidth do not produce white gaps.
Verifies that borderRadius is handled correctly without creating gaps.
The original change in element.bar.js remains the same; these tests just ensure the fix is covered automatically.
test: fix Bar element tests to use options.borderWidth (chartjs#12094)
minjibak
commented
Sep 19, 2025
Fixed an issue in the tests where bar.borderWidth was undefined in some environments.
Updated the tests to use bar.options.borderWidth instead, ensuring they pass consistently across platforms.
This change only affects the test code; the original pixel snapping fix in element.bar.js remains unchanged.
Apply pixel snapping only when snap option is enabled
minjibak
commented
Oct 21, 2025
@LeeLenaleee Hi, just an update regarding the previous commits:
The original fix remains unchanged, but I added a snap option to elements.bar. This allows pixel snapping to be applied only when explicitly enabled, which prevents test failures caused by automatic pixel snapping in certain environments.
No visual changes occur unless snap: true is set.
LeeLenaleee
commented
Oct 21, 2025
For a test I meant something that will break if the implementation gets reversed and the lines become visible again.
Also since you added the prop to the element so people can set it themself you will need to update the docs and TS files accordingly.
Changes
inflateRectfunction in element.bar.jsRelated issue