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 axis shows no ticks when all data points are less that the selected unit #7992

Closed
correaricardo opened this issue Nov 1, 2020 · 3 comments

Comments

@correaricardo
Copy link

When all data points have the same month, the month label is not shown

Expected Behavior

Show the current month in the labels section

Current Behavior

The month is not shown in the labels section

image

Possible Solution

I don't know

Steps to Reproduce

https://codesandbox.io/s/suspicious-field-fk4se?file=/src/App.js

Context

Environment

  • Chart.js version: 2.9.4
  • Browser name and version: Chrome 86
@etimberg etimberg changed the title Line Chart on a monthly times scale Time axis shows no ticks when all data points are less that the selected unit Nov 1, 2020
@correaricardo
Copy link
Author

I fixed it with a workaround. I wrote a function that check if all data have the same month and year and set unit time to: day, otherwise set unit time to: month.

@kurkle
Copy link
Member

kurkle commented Mar 2, 2021

Labels are added at start if unit. No month starts in the example period.

I don't think this is a bug. But this could be turned into an enhancement request, for placing the labels in the middle of the unit.

@kurkle
Copy link
Member

kurkle commented Mar 16, 2021

I don't think there is anything we can do about this. If the automatic unit selection does not work correctly, that could be altered, but when config states unit, chart will obey that.

@kurkle kurkle closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants