I'm trying to plot a treemap into my we system, I'm using php and mysql.
I have already several graphics (columns, pie, line, etc), but this one I 
just can't plot.

Here's part of the code where I search the data

$table = array();

                        //colunas 
                        $table['cols'] = array(

                                array('label'=>'Rota','type'=>'string'),

                                array('label'=>'Rota2','type'=>'string'),

                 array('label'=>'Entregas','type'=>'number'),

                                        
array('label'=>'Entregas_cor','type'=>'number')
                                );

                        //rows
                                $rows = array();
                                
                                        $query = $pdo->prepare("SELECT 
COUNT(sk_carga) as qtd_entregas, carga_rota as rota FROM dim_lg_carga where 
id_empresa = :sk_empresa GROUP BY 2");

                                        
$query->bindParam(':sk_empresa',$sk_empresa, PDO::PARAM_INT);
                                        $query->execute();


                                                        while 
($linha=$query->fetch(PDO::FETCH_ASSOC)){
                                                


                                                                $rota 
=$linha['rota'];
                                                                
                                                                $rota2 =null;
                                                                
                                                        $qtd_entregas = 
intval($linha['qtd_entregas']);
                                                                
                                                                
                                                $qtd_entregas_cor = 
intval($linha['qtd_entregas']);

                                                                $temp = array();

                                                                $temp[] = 
array('v'=>$rota);

                                                                $temp[] = 
array('v'=>$rota2);

                                                                
                                                                $temp[] = 
array('v'=>$qtd_entregas);

                                                                $temp[] = 
array('v'=>$qtd_entregas_cor);


                                                                $rows[] = 
array('c'=>$temp);
                                        }

                                                
                                                $table['rows'] = $rows;


                                                        $jsonTable = 
json_encode($table);
                                                        
                                                        
                                                        echo $jsonTable;





Here's the json code:


        google.setOnLoadCallback(desenharGraficoEntregasRotas);
                        

                                                function 
desenharGraficoEntregasRotas(){
                                                        // ajax
                                                        
                                                        var jsonDados10 = 
$.ajax({
                                                        
//url:"Model/Empresa/get_entregas_motorista.php",
                                                        
url:'http://localhost/sistema-bi-web/Model/Empresa/get_rotas_entregas.php',
                                                                dataType: 
"json",
                                                                async: false

                                                        }).responseText;


                                                var options10 = {
                                                                             
minColor: '#f00',
                                                                          
midColor: '#ddd',
                                                                          
maxColor: '#0d0',
                                                                          
headerHeight: 15,
                                                                          
fontColor: 'black',
                                                                          
showScale: true

                                                };
                                        
                                                        //dados do grafico
                                                        var dados10 = new 
google.visualization.DataTable(jsonDados10);

                                                
                                                var grafico10= new 
google.visualization.TreeMap(document.getElementById('grafico_entregas_rota'));

                                                        // desenha o grafico de 
acordo com os parametros passados
                                                        grafico10.draw(dados10, 
options10); 

                }

-- 
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/af3daead-62ce-4a21-9b23-efe727d626c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to