Your mistake is that your call of google.visualization.PieChart() is
outside your drawChart function.   See a working example here:
https://jsfiddle.net/dlaliberte/n1vytzhs/

On Mon, Jan 4, 2016 at 4:36 AM, Maël ATZORI MALTETE <
[email protected]> wrote:

> Hi every one,
> i have this error when i try the code for a PieChart : Uncaught TypeError:
> Cannot read property 'PieChart' of undefined
> the function is actually not known...
>
> my code :
>
> <html>
> <head>
>     <meta charset="UTF-8">
>     <title>Camembert</title>
>
>     <script type="text/javascript" 
> src="https://www.google.com/jsapi";></script>
>     <script type="text/javascript" 
> src="https://www.gstatic.com/charts/loader.js";></script>
>     <script type="text/javascript" 
> src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
> </head>
> <body>
> <?php
> $tt= $_GET['num'];
>
> include('model/config_path.php');
>
> $req="SELECT abo_ville, SUM(abo_qte_place_reserv) AS totalresa , 
> manif_intitule AS titremanif  FROM reservations INNER JOIN abonnes ON 
> abonnes.abo_id  = reservations.abo_id_  INNER JOIN manifestations ON 
> manifestations.manif_id = reservations.manif_id_ WHERE manif_id = 1 GROUP BY 
> abo_ville";
>
> $result = $bdd->query($req);
> $chart = $result->fetchAll();
>
> ?>
>
> <script type="text/javascript">
>     google.charts.load('current', {packages: ['corechart']});
>     google.charts.setOnLoadCallback(drawChart);
>     function drawChart() {
>
>         var data = google.visualization.arrayToDataTable([
>             ['Villes', 'Nombre de réservations'],
>             <?php
>                 foreach($chart as $key => $value){
>                 echo '[\''.$value['abo_ville'].'\', 
> '.$value['totalresa'].'],';
>             }
>             ?>
>         ]);
>
>         // Set chart options
>         var options = {'title':'How Much Pizza I Ate Last Night',
>             'width':400,
>             'height':300};
>
>     }
>
>     var chart = new 
> google.visualization.PieChart(document.getElementById('piechart'));
>
>     chart.draw(data, options);
> </script>
>
> <div id="piechart" style="width: 900px; height: 500px;"></div>
> </body>
> </html>
>
>
> i maybe did a mistake, tell me fast pls ! :)
>
> Thanks for your help
>
> --
> 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/e0240b84-c67e-42fa-9741-262046105754%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/e0240b84-c67e-42fa-9741-262046105754%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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/CAOtcSJNcRNdU4VOcSKmZMQdAqBVsJ7Dh-GD9HPuDL84aymQ%3DGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to