[Chartjs]-Charts.js – Colors for stacked bar on multi-series line/bar chart are not working

2πŸ‘

βœ…

Here it is:

https://jsbin.com/sijowuruda/edit?html,js,output

The issue is that these colors:

backgroundColor: ['rgba(71, 86, 119, 0.2)'],
borderColor: ['rgba(71, 86, 119, .8)']

need to be strings not arrays

backgroundColor: 'rgba(71, 86, 119, 0.2)',
borderColor: 'rgba(71, 86, 119, .8)'

Otherwise, there the chart lib will read one color for each column / per data type, and since you have a single color in your array, only the first column has a corresponding color for each data type.

Leave a comment