Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- url: CAMINHO+'relatorios/getAllPesqComData',
- type: 'POST', dataType: 'json',
- data: {aData:aData, idPesq:idPesq},
- success: function(ret){
- var codes = ret;
- $.ajax({
- url: CAMINHO+'relatorios/getAllPesqComDataEDados',
- type: 'POST', dataType: 'json',
- data: {aData:aData, idPesq:idPesq, codes:codes},
- success: function(retorno){
- // ...
- var dados = retorno;
- // ...
- function drawChart(){
- console.log(codes);
- console.log(dados);
- $.each(codes, function(index, el) {
- /** Criando e imprimindo a quantidade de gráficos carregados ... */
- var bloco = "PierChart"+codes[index]+"";
- $("#estatisticas").append("<div id='"+bloco+"'></div>");
- // Create the data table.
- var data = new google.visualization.DataTable();
- data.addColumn('string', 'Topping');
- data.addColumn('number', 'Slices');
- // O RPOBLEMA É AQUI ...
- // Esse é um loop, eu precisar iterar sob cada codes[index] puxando os dados referente
- // a cada um dos "ids" presentes na aplicação, algo parecido com >>> dados[codes[index]] ...
- data.addRows([
- ['Mushrooms', 3],
- ['Onions', 1],
- ['Olives', 1],
- ['Zucchini', 1],
- ['Pepperoni', 2]
- ]);
- // Set chart options
- var options = {
- 'title':'How Much Pizza I Ate Last Night',
- 'width' :900,
- 'height' :400
- };
- // Instantiate and draw our chart, passing in some options.
- var chart = new google.visualization.PieChart(document.getElementById(bloco));
- chart.draw(data, options);
- });
- }
- /*
- * Load the Visualization API and the corechart package.
- * Set a callback to run when the Google Visualization API is loaded.
- */
- google.charts.load('current', {'packages':['corechart']});
- google.charts.setOnLoadCallback(drawChart);
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement