I am generating a bar chart via chartjs. I have a predefined backgroundcolor array with 5 colors. I don't know how much data I get from my sql query. But I would like to use the predifened backgroundcolor. As soon as I have more than 5 data records, the other bars are not displayed correctly. Bar no 1 to 5 displayed correctly. All bars after no 5 are displayed like grey/black. How can I realize, that bar #6 gets the backgroundcolor of #1 and #7 gets the backgroundcolor of #2 and so on...?
var chartdata = {
labels: name,
datasets: [{
label: 'My Label here',
//backgroundColor: ['#3066be', '#2de1c2','#87bcde','#907ad6','#845a6d'],
backgroundColor:[
"rgba(255, 159, 64, 0.2)", //orange
"rgba(255, 205, 86, 0.2)", //yellow
"rgba(75, 192, 192, 0.2)", // green
"rgba(54, 162, 235, 0.2)", // blue
"rgba(153, 102, 255, 0.2)"], //purple
borderColor:[
"rgb(255, 159, 64)", //orange
"rgb(255, 205, 86)", //yellow
"rgb(75, 192, 192)", //green
"rgb(54, 162, 235)", //blue
"rgb(153, 102, 255)"], //purple
borderWidth: 2,
hoverBackgroundColor: [
"rgba(255, 159, 64, 0.4)", //orange
"rgba(255, 205, 86, 0.4)", //yellow
"rgba(75, 192, 192, 0.4)", // green
"rgba(54, 162, 235, 0.4)", // blue
"rgba(153, 102, 255, 0.4)"], //purple
data: marks
}]};