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

Last vertical grid line shows up in middle of chart in Chartjs 2.9.4. Fixed in 3.x #8373

Closed
Marc-Simard opened this issue Feb 3, 2021 · 2 comments · Fixed by #8781
Closed

Comments

@Marc-Simard
Copy link

Since the issue seems to be resolved in version 3.x, this is for documentation purposes only.

Expected Behavior

Vertical grid lines should be displayed at regular intervals.

Current Behavior

The very last vertical grid line shows up in the middle of the chart when the width of the chart is under a certain threshold.

ChartVerticalGridlineIssue

Possible Solution

Use a wider chart is a workaround, but may not be possible based on chart data & implementation.

Steps to Reproduce

Demo of the issue:
https://jsfiddle.net/Marc_Simard/fxeor2jt/2/

Environment

  • Chart.js version: 2.9.4
  • Browser name and version: Firefox / Chrome
@etimberg
Copy link
Member

etimberg commented Feb 3, 2021

This is caused by the overall chart type being 'bar'. If I switch it to 'line' it works correctly. This is likely due to the bar defaults for the offsetGridLines setting.

@Marc-Simard
Copy link
Author

Thanks for the input. Using line does seem like a better workaround. I played with my fiddle a bit more, and noticed that the issue no longer occurs when the chart is wide enough so that every xAxis label is displayed.
When a bit smaller, every second xAxis label is displayed, and that's when issue occurs. Going even smaller (every 3rd / 4th) also shows the issue.

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.

2 participants