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

Time scales labels not displayed if min & max are specified unless a unit is specified #5093

Closed
gkemp94 opened this issue Dec 28, 2017 · 4 comments

Comments

@gkemp94
Copy link

gkemp94 commented Dec 28, 2017

Encountered what I believe to be a bug/issue during my most recent project. Let me know if you have any questions about it.

Expected Behavior

When creating a chart with a min & max time specified but without setting unit, the unit should be inferred correctly in the same way as when min & max are not set.

Current Behavior

When creating a chart with a min & max time but no unit on either the x or y scale, no labels are being drawn. After looking through the code, it seems that the determineUnitForAutoTicks is returning an unreasonably large Unit "Month" in my case rather than something reasonable for my use case such as day.

Steps to Reproduce (for bugs)

  1. Create Line Chart with time on either axis
  2. Set min & max for that axis

Demo

https://codepen.io/gkemp94/pen/rpypLR?editors=1111

@jcopperfield
Copy link
Contributor

@gkemp94 This might have been addressed with PR #5045

@gkemp94
Copy link
Author

gkemp94 commented Dec 28, 2017

@jcopperfield Changed those lines in my local file and unfortunately there was no change.

@jcopperfield
Copy link
Contributor

jcopperfield commented Dec 28, 2017

@gkemp94 sorry read your question wrong.
The cause for the month unit selection in determineUnitForAutoTicks is the result of getLabelCapacity, which uses the milliseconds format to compute the capacity.
As a workaround you could add the option displayFormats: {millisecond: 'YYYY'} to increase the computed capacity.

@benmccann benmccann changed the title When setting min & max for time scales labels will not display correctly until a unit is specified Time scales labels not displayed if min & max are specified unless a unit is specified Aug 13, 2018
@etimberg
Copy link
Member

Appears resolved in v3.0.0-beta.4. See https://codepen.io/etimberg/pen/RwRawEG

@etimberg etimberg added this to the Version 3.0 milestone Oct 16, 2020
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