Using Chart.js version 3.8.0 (the latest release)
Hello everyone
I'm really struggling with this right now. I was able to successfully display the chart once, but now it's failing to render and I have no clue why.
Prior to setting the chart options, I created an object array (which counts lines in multiple CSV files) and then passed this array as per the examples on the Chart.js website.
I've checked the console output to ensure that the data is loading correctly and everything seems fine. Can someone please take a look at the code below and point out anything obvious?
const data = YTDTable;
var ctx1 = document.getElementById('YTD').getContext('2d');
var myChart1 = new Chart(ctx1, {
type: 'bar',
data: {
datasets: [{
data: data,
label: "Tickets to Date"
}]
},
options: {
parsing: {
xAxisKey: 'month',
yAxisKey: 'count'
}
},
});
This is the dataset output of console.log(myChart1.data) which is executed after the above code block:
{
"datasets": [
{
"data": [
{
"month": "January",
"count": 1629
},
{
"month": "February",
"count": 1832
},
{
"month": "April",
"count": 1626
},
{
"month": "May",
"count": 2034
},
{
"month": "March",
"count": 1802
},
{
"month": "June",
"count": 1585
}
],
"label": "Test"
}
],
"labels": []
}
I can't understand what's causing the issue with the code above. Any assistance would be greatly appreciated.
The chart output on the screen can be viewed here: chart image - can't embed images yet...