Answer the question
In order to leave comments, you need to log in
js, canvas problem, need help fixing it?
Code (Spoiler)
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: myLabels,
datasets: [{
data: myData,
backgroundColor: palette('tol', myData.length).map(function(hex) {
return '#' + hex;
}),
hoverBorderColor: palette('tol', myData.length).map(function(hex) {
return '#' + hex;
}),
hoverBorderWidth: '20px'
}]
},
options: {
cutout:'80%',
responsive: true,
plugins: {
tooltip: {
enabled: false,
},
legend: {
display: false,
},
title: {
display: false,
}
},
onHover: function(event, activeElements){
if (activeElements.length > 0) {
var value = myChart.data.datasets[0].data[activeElements[0].index];
payment_groups_js.current = value;
var label = myChart.data.labels[activeElements[0].index];
}
else {
payment_groups_js.current = payment_groups_js.total;
}
myChart.update();
}
},
plugins: [chartAreaBorder, chartAreaBorder2, chartAreaBorder3]
});
Uncaught TypeError: Cannot read property 'map' of null
Answer the question
In order to leave comments, you need to log in
Konfy - thanks man helped find the solution.
The problem is in the tol variable (if the value is equal to 12 or more, it returns null), the problem was solved by replacing tol with sequential
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question