0👍
✅
When you use
let localConfig = chartConfig;
in javascript you do not get a copy of the object. Both values will point to the same reference. When you mutate one the original also mutates.
Try
let localConfig = JSON.parse(JSON.stringify(chartConfig));
See this question for different possibilities to deep clone a javascript object.
0👍
You could try to create an array of colors dynamically.
Check it chartjs creating data array dynamically
Source:stackexchange.com