-
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
backgroundColor doesn't work since v4? #11002
Comments
See #10927 You could disable the colors plugin or move the |
I think this is an oversight in the check if the plugin needs to be enabled. |
Thanks I moved inside datasets[i].backgroundColor and it seems to work like before. |
@DavideViolante as @LeeLenaleee outlined, what I proposed is a workaround. It seems to be an oversight in the plugin implementation. @LeeLenaleee I think the issue is Chart.js/src/plugins/plugin.colors.ts Lines 70 to 72 in da34804
because is invoked passing the options but I doesn't seem matching the type. I think it should ColorsDescriptor (no array) but maybe I'm wrong. |
The problem is that the function is invoked with the dataset and the elements but not the root of the options in which you can also define it. Chart.js/src/plugins/plugin.colors.ts Lines 97 to 102 in da34804
|
@LeeLenaleee FYI I have submitted a PR. |
Expected behavior
On latest v3 I used options.backgroundColor: [array of strings of hex colors]. On v4 it doesn't seem to have any effect, and I can't find any migration about that.
Edit: it seems it must be inside datasets array, where is this mentioned in the migration from v3 to v4?!
Current behavior
Default light blue colors are shown.
Reproducible sample
https://codepen.io/davideviolante/pen/NWBWdaa
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
No response
chart.js version
v4.1.1
Browser name and version
No response
Link to your project
No response
The text was updated successfully, but these errors were encountered: