It crashes on line 277 of core.datasetController.js
Why am I even there?
The property it is handling seems to be fill but I don't understand why?
I am effectively trying to display 6 lines with the same x-axis using stacked on the y-axis
Any ideas? Pete
I've used the debugging features of Chrome which is why I know where the crash happens but not why.` Here's my code:
<body>
<div id="chart-container">
<canvas id="graphCanvas"></canvas>
</div>
<script type="text/javascript">
$(document).ready(function () {showGraph();});
function showGraph()
{$.post("data_stacked.php",function (data)
{
console.log(data);
var tags = [];
var annee = [];
var number = [];
var data_set = [];
var backgroundColors = [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)',
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
];
i = 0;
data_array=JSON.parse(data);
Object.keys(data_array).forEach(key => {
annee = [];
number =[];
college = key;
let element = new Object();
Object.keys(data_array[college]).forEach(key => {
annee.push(key);
if (!tags.includes(key)) tags.push(key);
element = data_array[college][key];
number.push(element);
});
data_set[i] = [
{
label: college,
backgroundColor: backgroundColors[i],
stack:'combined',
type:'line',
fill: false,
borderColor: '#46d5f1',
hoverBackgroundColor: '#CCCCCC',
hoverBorderColor: '#666666',
data: number
}];
i++;
});
var chartdata = {
labels: tags,
datasets: data_set,
options: {
scales: {
y: {
stacked: true
}
},
plugins: {
title: {
display: true,
text: 'Adhérents'
}
}
}
}
var graphTarget = $("#graphCanvas");
console.log(chartdata);
var Graph = new Chart(graphTarget, {
type: 'line',
data: chartdata
});
});
}
</script>
</body>