Hello everyone, I'm starting on the Node and I got a F .. logo from kra. develop an API for a Dash and use Google Charts. I already researched and collected some ideas from here of the forum then;
I did so;
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
$.get('/api/v1/users', function(response) {
console.log(response);
asynchronous: true
var chartData = [];
for(var idx = 0; idx < response.length; ++idx) {
var item = response[idx];
chartData.push([item.Tarefa, item.Por_dia]);
}
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Tarefa');
data.addColumn('number', 'Por_dia');
data.addRows(chartData);
var options = {
title: 'Tarefas diárias'
};
//create and draw the chart from DIV
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}, 'json');}
The error is this, I've tried, "use", "ajax" and the error is the same.
TheAPIIusedwasthis APIDEMO works perfectly listing what's in the Mysql table.
My goal is to pass mysql data via api node in google charts.
Thanks for the help.