-
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 performance improvement #6019
Conversation
Nice that you are optimizing! But, did you realize its going to return different format for different ticks now? In short of removing the whole The "remove the whole thing approach" would be to provide less magic out of the box and set just 1 default format - requiring user to change it, if the default does not suit a chart. |
I feel this PR is implementing the same behavior initially rejected in #4583
Already discussed in #4583 (comment)
I agree and already suggested: #5095 (comment). What about always falling back to |
Yes. I think that's okay. It can be understood as consistently showing the most detail necessary and no more. While not consistent in the format, it's consistent in the logic and always shows a fairly reasonable default.
I wouldn't be opposed, especially in the
I'd prefer that to the implementation in master, which has a performance degradation. But, in my opinion, it's a bit overkill for a chart showing only annual values. I've attached a screenshot of what that looks like below. |
@benmccann how about defaulting to |
If you had a chart that was displaying milliseconds then it would show the same tooltip for every data point. And it still seems a bit overkill still for the annual case like the screenshot above |
This is based on your expectations, for example (pushing things a bit further), why should we display minutes and seconds for
Again, I think this generates a poor default user experience, for example:
When displaying tooltips point by point, the user will have to "guess" the missing components, I find this quite disturbing while focusing on the moving part (e.g. the hours or, worse, the milliseconds).
Most of the time it will be overridden by the user via |
acd515c
to
9521956
Compare
I don't necessarily agree that the user has to guess the missing part since it's always 0. That being said it's clear that there's agreement not to go with the approach I initially proposed, so I've gone ahead and removed the whole |
9521956
to
e5862d3
Compare
I think this is going to the right way. |
Another idea... What about
|
IMO a solid default and no magic is good for this kind of regional option. |
I agree. I initially thought we should go with a date built-in method (e.g. If we go with I think my preference goes for |
Ok, I've made those changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good direction to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also need to update the formats
documentation to ensure that implementers of other adapters know that datetime
is expected as key in the dictionary. Perhaps this can be done by updating the unit
docs?
@etimberg thanks for taking a look. I updated the docs. Let me know what you think. I didn't update |
4d7fa88
to
03e6178
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @benmccann
Remove the logic that computed an "optimal" tooltip format. Instead, always fallback to the `datetime` adapter format which is more efficient and stable. Additionally, remove the adapter `presets` API, which is not needed anymore.
determineLabelFormat
was looping through every data point on chart creation and creating a new moment object for each one. This was a major part of the time to render a time chart and was unnecessary. Since it's only used to format the tooltip we can just do it for the corresponding data point when the tooltip is displayed