-
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
Global datasets options thought #6684
Comments
We're working on 3.0 right now, so also curious about how you would structure these if you didn't have to worry about backwards compatibility. E.g. we're considering removing the Chart.js/src/core/core.defaults.js Line 14 in 72df272
|
@benmccann first of all let me say the current chain on options is really good and consistent, in my option, therefore we won't change it in the logic (maybe accepting to rename and move objects in the options tree, whatever it is). Table with levels and objects path for dataset options:
Some thoughts about above table:
Going to version 3 (removing global), I have also change the path. But now, there is another question: what about In this way it's clear that whatever default dataset options must be set into a dataset object and the chain is clear. I know that could be complex and break backwards compatibility (at least the |
Yes, I agree we should remove the Regarding |
@benmccann I'm not 100% sure I understood correctly what you mean. Let me try to explain what I thought. With the proposal nothing change because we can use the current way and every time you have got a Therefore I can not understand how the Please forgive my lack of deep knowledge of internal implementation of Chart.js and take what I'm said using my previous assumption. |
@benmccann Today I had a look to the master to check some changes of version 3. |
I wasn't necessarily against it, but no one had gotten to it. I just sent #6955. See if it matches your expectations |
GREAT @benmccann !! Really appreciated your support! |
I've merged #6955, is that enough to close this? |
@stockiNail please check the latest code from |
@benmccann Perfect! I'm gonna update the project and have a look. I need a couple of days because busy in other stuff. |
@benmccann finally I've checked right now! SOUNDS really good! |
Yes, a lot has changed. I hope the improvements make it worth it. Here's a migration guide to help your testing: https://github.com/chartjs/Chart.js/blob/master/docs/getting-started/v3-migration.md |
I have already had a look...
In my opinion, based on my experience, this kind of changes are moving effort to user side.
I don't understand how reducing the scope on chart area can help. To have more listeners on the same dom element it does not make sense if you can have 1, as is today. At the end of the day, I'll do my best to be 100% aligned to new version, just a matter of time. |
@benmccann today I've released new vesion of my project and then I spent some minutes to go in deep about date adapter. I thought |
Work is still in progress on that piece. We've moved adapter-moment to a new repo. The plan was to remove it from the main repo after a release is cut on the new repo One problem with creating a bundle would be which library do we include by default in the bundle? We have three different date adapters and everyone has their favorite one. Also, moment was used originally because it was one of the original date libraries, but it's much worse than the alternatives and I wouldn't recommend anyone to use it. It has a terrible API where everything is mutable and it's a huge library. You could use the Luxon adapter and get way more features (timezones, i18n, etc.) or the date-fns adapter and get a smaller library. Those would both be much better choices for any new project. But then there's a tricky thing of old users have moment, but we wouldn't want to promote it to new users. We'd almost have to create three bundles. |
Got it!
I saw it and also that it is not published in jsdelivr yet and I had the feeling that is still in progress. Thank you very much, @benmccann |
@stockiNail FYI this change was reverted by #8090. See #8073 for explanation. |
Thank you @kurkle
|
Documentation Is:
Current documentation
Having a look to the current documentation, the chain to set the datasets options is:
What's not clear
There is another default setting for chart type, where global chart settings are stored in
Chart.defaults[type]
.Does it mean that you can set the datasets options also at global chart level?
If yes, with
Chart.defaults[type].dataset
object?If not, is this missing or not applicable?
In my personal (and not relevant) opinion, the datasets object related to chart type should be defined into global chart options (
Chart.defaults[type].dataset
) and not into default options (Chart.defaults.global.datasets[type]
) because you have already options for chart type.Am I wrong?
About the chain,
element
objects are always overlap bydatasets
ones, therefore my understanding is datasets options are evaluated with the following priority:Correct?
The text was updated successfully, but these errors were encountered: