Chartjs-Chart.js – Give specific circles a background color in a bubble chart

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.

Leave a comment