score:0

i created a jsfiddle to reproduce what you are trying to do. i can see that the colours are rendering fine after making one small change to your code: i had to set marksdata.datasets[i] = {} instead of marksdata.datasets[i] = []

for (i = 0; i < 6; i++){
     marksdata.datasets[i] = {};
     marksdata.datasets[i].label = domaines[i];
     marksdata.datasets[i].data = [{}];
     marksdata.datasets[i].backgroundcolor = colors[i];
}

edit: the issue was you were setting dataset as an array, while it should've been an object.


Related Query

More Query from same tag