this time i'm studying Google Charts, the following code shows how i get an array to send it to the function to draw the chart:
$.get("Inform.php?proyecto="+$("#Proyectos option:selected").text(), function( data ){
$.each(data, function(id,value){
var tmp = {
'value1':""+value['value1']+"",
'value2':""+value['value2']+"",
'solution':""+value['solution']+""
};
ListaA.push(tmp);
});
});
google.load('visualization', '1', {'packages': ['corechart']});
google.setOnLoadCallback(drawChart);
return;
Now the drawChart() function
function drawChart(){
try{
var dataTable = new google.visualization.DataTable(listaA);
var options = {
'title':'Title',
'width':400,
'height':300
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(dataTable, options);
}catch(err){
alert(err.message);
}
}
Finally the HTML element to load the chart is this one
<div id="piechart" style="width: 900px; height: 500px;"></div>
As you can see on second block of code i used try/catch to know what kind of error i could get from there but i got nothing, no errors, no chart drawed, maybe i did something wrong on the array or calling the chart function, i don't know.
I hope you can help me how to call properly this function in order to get the chart related with my array. Thank you for your time and attention.
console.log(). Use it to checkdatainside$.get, thenListaAafter the.push, etc... Check if every value is as expected, until you find the one that isn't and explaines the results you're getting, or not getting