Chartjs-Why is this Chart.js graph not showing the right colors?

0👍

So I had to add a foreach to add the same color to every entry in both arrays and that fixed the issue:

Fixed issue

var colors_entregas = [];
var border_entregas = [];
entregas.forEach(function (el){
    colors_entregas.push('rgba(255, 99, 132, 0.2)');
    border_entregas.push('rgba(255, 99, 132, 1)');
});
var colors_reversas = [];
var border_reversas = [];

reversas.forEach(function (el){
    colors_reversas.push('rgba(54, 162, 235, 0.2)');
    border_reversas.push('rgba(54, 162, 235, 1)');
});

Inside every dataset:

data: entregas,
backgroundColor: colors_entregas,
borderColor: border_entregas,

Leave a comment