-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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 Scale should align to beginning of time period #4187
Comments
I agree that that is probably a useful feature. I don't know if by making this change existing users would be unhappy. Do you think something like this should live behind a configuration setting? |
For half of it. There are two things I asked for here:
|
I can agree to part 1 being always on. I think it should actually be relatively straightforward because all I think needs to be done is taking away a few ifs. https://github.com/chartjs/Chart.js/blob/master/src/scales/scale.time.js#L251 and then making sure we round to the correct unit rather than the value of the Part 2 is more complicated. Right now the axis only has the concept of tick marks. We'd need to introduce the concept of minor tick marks. I don't think it's actually too bad other than it requires duplicating a bunch of settings so they can be configured independently and having a second array of ticks (or storing the type of tick in the items in |
I don't think we actually need to expose any concept of major/minor tick marks to the user in which case it wouldn't necessarily be that much more complicated. We already have the unit from |
That's actually a good idea. Should be relatively straightforward to do and changing the text might actually already be possible with the |
+1 on this idea! I like what I read. |
I've documented how this should be implemented from a technical perspective in #4612. I'm going to close this issue in favor of that one, which has a lot more technical detail and should be much more helpful to an implementor |
This can be reproduced with the current samples in master
Current Behavior
Samples show:
Expected Behavior
It would be nicer if these instead said:
It's much easier to read the chart when it aligns on full days (or hours, weeks, months, etc.). E.g. in this case we should always try to have some labels at midnight as 9am and 9pm are weird times to align our labels to.
Also, much of the information is repetitive. You only need to print the major time period when you hit it and only need to print the minor time period in between. We should at least have an option that allows for this if we don't always do it (and I think setting it to true by default would be nice)
Steps to Reproduce (for bugs)
git clone [email protected]:chartjs/Chart.js.git
npm install
gulp build
Examples
https://www.amcharts.com/stock-chart/
Here are a couple screenshots from other time series charts


The text was updated successfully, but these errors were encountered: