*Bom would have a new program, Google Earth. Estou precando de uma ajuda, 
pois, tenho uma taba no banco de dados com os campos (pergunta, ótimo, 
bomb, ample), evil o campo pergunta recebe uma string e os outros campos 
numero. You're welcome, you're welcome, you're welcome, you're welcome, and 
you're welcome to talk to me, you're welcome, and you're welcome.*

Below is code that calls json



<script type="text/javascript">
google.charts.load('visualization', '1', 
{packages:['corechart'],'language':'pt-BR'});
google.charts.setOnLoadCallback(desenhaGraficoPerguntas);

function desenhaGraficoPerguntas(){

    var jsonData = $.ajax({
    url:"getAllDespesas.php",
       dataType: "json",
       async:false
          }).responseText;

        var dados = new google.visualization.DataTable(jsonData);      


        var option = {
           width:960,
           height:500,
           title: 'Gráficos de Perguntas'           
        }

        var chart = new 
google.visualization.PieChart(document.getElementById('div-chart'));
   chart.draw(dados, option);
</script>
<h3>Gráfico Pizza</h3>
<div id="div-chart" class="div-chart"></div>
<hr>

</body>
</html>


*The other file that generates json follows below*




  try{

         require_once 'conexao.php';
          //$conn  = new 
PDO("mysql:host=".HOST.";dbname=".DATABASE,USER,PASS);
          $table = array(); 
          $table['cols']=array(
                                 array('label'=>'Pergunta', 
'type'=>'string'), 
                                 array('label'=>'otimo', 'type'=>'number'),
                                 array('label'=>'bom', 'type'=>'number'),
                                 array('label'=>'ruim', 'type'=>'number')
                           );

            $rows = array();
            

          $result = $pdo ->query('SELECT * FROM frases_novas ');
          if($result){
          
          while ($linha = $result->fetch(PDO::FETCH_ASSOC)) {
          

             $pergunta = $linha['texto'];
                  $resposta_zero=$linha['otimo'];
           $resposta_um=$linha['bom'];
           $resposta_dois=$linha['ruim'];
           $temp=array(); 
                  $temp[]=array('v'=>utf8_encode($pergunta));
           $temp[]=array('v'=>$resposta_zero);
                  $temp[]=array('v'=>$resposta_um);
           $temp[]=array('v'=>$resposta_dois);
           $rows[]=array('c'=>$temp);
}

$table['rows']=$rows;

$jsonTable =json_encode($table);
              }

              echo $jsonTable;

          }catch(PDOException $i){
          print "Erro:".$i->getMessage();
          }

         
       
     }
}




And the graph generated is this


<https://lh3.googleusercontent.com/-I8hVZG4MEOM/WSRK1p6fNbI/AAAAAAAAL8A/0yedUN68FzcPQz0CSZEmiujNNe-5C0-mQCLcB/s1600/grafico_piechart.png>



But my goal is to have this graph

<https://lh3.googleusercontent.com/-SAzDxOv-x2s/WSRM1umvIuI/AAAAAAAAL8M/fBSqJ_8f7AckgbBpgt-gWcGcb7IX5RJGQCLcB/s1600/grafico.png>

In the database, this graph must be mounted per line.

<https://lh3.googleusercontent.com/-JrEK4NUkl_4/WSRNqwK4i3I/AAAAAAAAL8Y/fA3CeAES1tItrKzmhGDfwFFjuBvXuvolgCLcB/s1600/tabela.png>


-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/44b7d629-701a-4b0d-9f83-548a9e70b188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to