ChartJS - setting the backgroundColorScheme

Hello,

I am currently using ChartJS 2024.3.2 with Servoy 2024.3.5.3948_LTS.
I want to make use of the backgroundColorScheme property of the chart.
The problem is, if i set the chart data using

elements.chart.setData(dataObj); //no backgroundColor defined in the dataObj

then the backgroundColorScheme is no longer applied, and my chart is in a pastel (probably default) color scheme.
This does not seem to work:

elements.chart.backgroundColorScheme = 'bootstrap'

How can i set the backgroundColorScheme programatically, after I have set the data ?

Thank you.

The backgroundColorScheme property is only supported with design-time based charts. If you need it done programmatically, you will need to do it directly within the dataObj as using setData will override any design time setting for charts.

You can find the color schemes that were used in the following link.

1 Like

Thank you, @tnguyen,
Probably it is also the reason why

elements.chart.clearChart()

does not always work when I set the data programatically.