-
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
Plugin options, as array, are passed as an empty object to plugin methods #7754
Comments
Do you know if there are many plugins expecting array as options? |
I don't know how many plugins are using an array as options. The plugin is chartjs-plugin-labels. Honestly it does not seem so maintained. And I have already updated it in order to be used on ChartJs 3, therefore is not a showstopper for me. I don't know if makes sense to change in order to be compliant with previous version. Personally I prefer to have an object to configure a plugin and not an array. |
The options are merged with the defaults in v3, that's where it fails. |
Arrays would need to be merged per instance but it causes problems as we saw with the scale options. I'm happy to document it as a breaking change from v2. I suspect the unmaintained annotations plugin suffers from the same problem. |
Annotation plugin is configured in different way but it is using array to have multiple annotations therefore I suspect as well. |
Arrays are fine within the configuration object. |
Fine! That means only labels plugin has got this issue, not annotation or datalabels, therefore in my opinion I fully agree with @etimberg to leave as is today, documenting it. |
Errata corrige: datalabels does not use array for multiple labels |
I'm testing some plugins, migrating to Chartjs 3.
I see a breaking change (I don't know if it is a bug) on plugin implementation between version 2.9.3 and 3.0.0.
Many plugin methods (like
beforeUpdate
) are receiving as argument the plugin options instance.In the version 2.9.3, if the plugin is configured into the chart options by an array of objects, the array was passed as argument to the plugin methods.
Instead in version 3.0.0 if the plugin is configured into the chart options by an array of objects, a empty object is passed as argument to the plugin methods.
Here is codepen (with v3): https://codepen.io/stockinail/pen/dyMZoZX
Maybe it's not a bug but something that we want.
The text was updated successfully, but these errors were encountered: