score:2

Accepted answer

in chart.js, array of colors for the backgroundcolor and bordercolor properties are for bar-type charts for instance, since you have different elements in your graph (several bars).

in the line-type, you only have one element (the line, with the fill below), so you need to set these properties with a single color.


if you change these properties to :

datasets: [{
    label: '# of votes',
    data: [12, 19, 3, 5, 2, 3],
    backgroundcolor: 'rgba(255, 99, 132, 0.2)',
    bordercolor: 'rgba(255,99,132,1)',
    borderwidth: 1
}]

you will get the following result, which you can check at this fiddle :

enter image description here


Related Query

More Query from same tag