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

#3483 Fix x-axis tick alignment #3505

Merged
merged 2 commits into from
Nov 22, 2022
Merged

#3483 Fix x-axis tick alignment #3505

merged 2 commits into from
Nov 22, 2022

Conversation

sadsunshower
Copy link
Contributor

Fix x-axis tick alignment

Fixes #3483. The underlying issue was that some x-axis ticks would end up in the wrong position, overlapping in some cases and being deleted by the code to ensure ticks don't overlap. This seems to be because the first tick on the x-axis has its position adjusted in two places: first by setting and adjusting firstTickPosition according to remainingMins on line 620, and then again inside the loop - which I remove in this change.

I've also added a unit test which fails under the old code. This test makes sure that the generateHourScale function generates x axis ticks which do not overlap under the conditions seen in #3483.

Before:
Screenshot of chart before changes

After:
Screenshot of chart after changes, with the x axis aligned to the data

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
    - [ ] I have commented my code, particularly in hard-to-understand areas - no comments needed for this change IMO, happy to add some if requested
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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

Successfully merging this pull request may close these issues.

Missing time on date time X-axis under certain conditions
2 participants