I am implementing graphics in my application made in PHP, using Framework Chart.js, passing the query data via JSON, to mount the chart, but when I render it it presents the following error:
Followingcode:
$(document).ready(function(){$.ajax({url:"http://des.ead.prodemge.gov.br/gea/develop/graficos/data.php",
method: "GET",
success: function(dados) {
console.log(dados);
var departament = [];
var acesso = [];
for( var i in dados){
departament.push("Departamento "+dados[i].department);
acesso.push(dados[i].qtdacesso);
}
var chartdado = {
labels:departament,
datasets:[
{
label: 'Departamento Acessos',
backgroundColor: 'rgba(200, 200, 200, 0.75)',
borderColor: 'rgba(200, 200, 200, 0.75)',
hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
hoverBorderColor: 'rgba(200, 200, 200, 1)',
dados:acesso
}
]
};
var ctx = $("#mycanvas");
var grafico = new (ctx, {
type:'bar',
data:chartdado
});
},
error: function(dados){
console.log(dados);
}
});
});