Answer the question
In order to leave comments, you need to log in
Error "Cannot read property 'getContext' of undefined". What could it be?
I have a task to display a graph on the site, there is such a code:
watch: {
dataset: {
handler(newValue, oldValue) {
if (newValue && newValue.length) {
console.log(this.immediate);
let chartData = {
labels: [],
datasets: [
{
label: "Data 1",
backgroundColor: 'red',
/* showLine:true, */
data: this.dataset,
},
],
};
this.dataset.forEach((item) => {
chartData.labels.push(item.x);
chartData.datasets[0].data.push(item.y);
});
this.renderChart(chartData, {
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text: "My Data",
},
});
}
},
immediate: true
}
},
Uncaught (in promise) TypeError: Cannot read property 'getContext' of undefined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question