Estoy intentando mostrar un gráfico de líneas con Chart.js y en este caso me muestra el error "Failed to create chart: can't acquire context from the given item" y no encuentro el motivo.
El codigo html es:
<div align='center'><canvas id='grafico_ventas' width='280vw' height='240vw'></canvas></div>
y el codigo jquery es
var ano = "2020"
var ano_ant = "2019"
var ctx_gp = document.getElementById("grafico_ventas");
var grafico_ventas = new Chart(ctx_gp, {
data: {
labels : ["ENE","FEB","MAR","ABR","MAY","JUN","JUL","AGO","SEP","OCT","NOV","DIC"],
datasets: [{
type: 'line',
label: ano,
data :[[12654.13,11889.39,7660.59,6284.87,5959.92,4786.71,0,0,0,0,0,0]],
backgroundColor: ['rgba(255, 99, 132, 0.2)'],
borderColor: ['rgba(255,99,132,1)'],
hoverBackgroundColor: ['rgba(255,99,132,0.4)'],
borderWidth: 1
}, {
label: ano_ant,
type: 'line',
data: [[12516.06,11217.55,9859.06,11071.59,10541.18,9999.59,12947.56,17804.7,10028.87,12695.56,11918.95,9515.36]],
backgroundColor: ['rgba(113, 179, 124, 0.2)'],
borderColor: ['rgba(113, 179, 124,1)'],
hoverBackgroundColor: ['rgba(113, 179, 124,0.4)'],
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
¿alguna sugerencia?