-
Notifications
You must be signed in to change notification settings - Fork 331
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
Move element fallback to plugins.annotation.common #630
Conversation
@kurkle probably the documentation about the common configuration (/~https://github.com/chartjs/chartjs-plugin-annotation/blob/master/docs/guide/configuration.md) should be changed. I'm going to test it but the events callbacks will stay at |
Yes, I wanted to see what you think about this before updating docs. Not sure about the
Yes, the plugin options stay at that level, only the element fallback options are nested. |
It sounds good to me. off-topic: could common contain also the "common options" defaults among all elements (like shadow or x/yScaleID, x/yMin or x/yMax? |
Animations are only resolved from plugin options, elements can't (currently) overwrite that. It can be changed if we want to configure the animations per element type, but I don't think we have real use cases for that (yet).
Yes, that has been the original idea, but it needs a little more work. Currently we are using the "keys" from element defaults as the list of properties to resolve. So we could add the common keys to that list and would not need to have those common keys listed in element defaults at all. What do you think about |
personally I would prefer |
This is something that I haven't understood yet. For all tests that I have done, if you don't set the key as undefined, the fallback doesn't occur. |
This is where the keys are read from defaults object: chartjs-plugin-annotation/src/annotation.js Lines 187 to 191 in d999608
|
Ok, therefore the keys must be defined. In teh label annotation, there is a useless |
@kurkle I think it could be helpful to add an additional option ( This PR will add a common defaults for all annotations and it can contain the
What do you think? |
Fix #625
Alternative approach to this isssue. I like this better than #629, but this is a breaking change (most notably the
drawTime
option not read fromplugins.annotation.drawTime
as fallback any more)Noticed the drawTime fixture was not tested relative to dataset, so added some data to that.