I am getting the data and labels for my ChartJs chart via ajax and I create an array out of this.
When I make a console.log, the array looks like it would be working, but the chart has no labels and no data.
I've found this question here, but it doesn't solved the problem.
Here is my code for the chartJs:
config = {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: "Aufrufe",
data: dataarray,
backgroundColor: 'rgba(0, 188, 212, 0.8)'
}]
},
options: {
responsive: true,
legend: false
}
}
and the arrays that I get from console.log:
That's how I create the array:
/* create a labels array */
while(year !== (new Date).getFullYear() || month !== enddate) {
console.log(year, month);
labels.push(month + " " + year);
month++;
if(month === 13) {
year++;
month = 1;
}
}
But the chart is simply an empty chart...