0👍
I don’t believe this has anything to do with chartjs — the code in your getData function seems very strange to me.
Specifically, this section:
rows.forEach(row => {
const cols = row.split(',');
rows.push(cols);
console.log(cols);
xlabels.push(cols[0])
ylabels.push(cols[1])
});
I am not sure what format you’re expecting the data to come out in, but you’re adding more entries to your rows
array inside a forEach function running on every element of rows
— this type of half-iterative, half-recursive behavior seems like a mistake, and is leading to two arrays with 1 label and 1 value each. It’s hard to give more helpful advice than that without knowing how you’ve formatted the stats.csv file.
Chart.js expects, essentially, an array of labels and an array of values. What you are console logging currently is not that.
Source:stackexchange.com