Skip to content
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

Bar Chart offset property Does not work with time axis type #10215

Closed
jmtimko5 opened this issue Mar 3, 2022 · 5 comments · Fixed by #10278
Closed

Bar Chart offset property Does not work with time axis type #10215

jmtimko5 opened this issue Mar 3, 2022 · 5 comments · Fixed by #10278

Comments

@jmtimko5
Copy link

jmtimko5 commented Mar 3, 2022

Expected behavior

According to the documentation, the offset property of a scale on a bar chart should prevent the first and last bar on the chart from being cut off. The docs actually say this is true by default.

Current behavior

First and last bar are cut in half, even when offset is explicitly specified as true.

Reproducible sample

https://codesandbox.io/s/bar-chart-offset-issue-ofkyer

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

This primarily seems to happen with every scale type on the x-axis that is not category. This makes bar charts not usable for any axis type outside of category axis in my product.

chart.js version

v3.5.1

Browser name and version

Chrome

Link to your project

No response

@jmtimko5 jmtimko5 changed the title Bar Chart offset Property Does not do anything Bar Chart offset Property Does not work with time axis type Mar 3, 2022
@jmtimko5 jmtimko5 changed the title Bar Chart offset Property Does not work with time axis type Bar Chart offset property Does not work with time axis type Mar 3, 2022
@etimberg
Copy link
Member

etimberg commented Apr 3, 2022

The issue here is that the offsets to keep the bar visible is working with the ticks that were generated before auto skipping is applied. Offsets for a time chart will need to be recomputed after auto skipping

@kurkle
Copy link
Member

kurkle commented Apr 3, 2022

@etimberg I think it was actually "fixed" to be calculated before auto skipping. So it would probably need an option.

@etimberg
Copy link
Member

etimberg commented Apr 3, 2022

good to know, I'll add a config option for it. I have the test passing now

@kurkle
Copy link
Member

kurkle commented Apr 3, 2022

Could not find the PR for it though, so my memory might server wrong :)

@etimberg etimberg added this to the Version 3.8.0 milestone Apr 3, 2022
@jmtimko5
Copy link
Author

jmtimko5 commented Apr 4, 2022

Awesome thanks so much for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants