2👍
You actually don’t even need to try and set the colors inside the chart.js object itself. The background
dataset property accepts either a single color value, or an array of color values (where the index in the color array maps to the index in the data array).
See this documented in the API here.
property: backgroundColor, type: Color or Array
Here is an example showing this in a bar chart (only focus on the usage of the array in the backgroundColor
property. It’s the exact same concept for a bubble chart.
- Chartjs-How to remove a label in top of bar in chartjs chart
- Chartjs-Chart js don't center pie chart correctrly
Source:stackexchange.com