Vincenzo,

When you call google.setOnLoadCallback() it always takes a function, not a
function call and setOnLoadCallback always calls that function with no
arguments.  Sounds like you might be stuck, except you can create another
function that calls your drawChart function with one or more arguments.  So
instead of

  google.setOnLoadCallback(drawChart);

you would want something like this:

  google.setOnLoadCallback(function() { drawChart(123) });

Hope that helps.


On Fri, Jun 13, 2014 at 11:10 AM, Vincenzo Diligente Tizzani <
[email protected]> wrote:

> Hi,i have a question.
> This is my index.php:
> <html>
>     <head>
>         <meta charset="UTF-8">
>         <title>Prova</title>
>
>
>
>     <!--Load the AJAX API-->
>     <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>     <script type="text/javascript" src="//
> ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
>     <script type="text/javascript">
>
>     // Load the Visualization API and the piechart package.
>     google.load('visualization', '1', {'packages':['corechart']});
>
>     // Set a callback to run when the Google Visualization API is loaded.
>     google.setOnLoadCallback(drawChart);
>
>     function drawChart(num) {
>       var json = $.ajax({
>           url: "prova.php",
>           data: "q="+num,
>
>           dataType:"json",
>           async: false
>           }).responseText;
>
>
>       // Create our data table out of JSON data loaded from server.
>       var datachart = new google.visualization.DataTable(json);
>
>         var options = {
>
>                     is3D: 'true',
>                     width: 800,
>                     height: 600
>
>                 };
>        var chart = new
> google.visualization.PieChart(document.getElementById('chart_div'));
>       chart.draw(datachart,options);}
>
>
>       </script>
>
>    <form>
>   <select name="Parametr"  onchange="drawChart(this.value)">
>   <option value="">Select a Parameter:</option>
>   <option value="Param1">Parametr1</option>
>   <option value="Param2">Parametr2</option>
>   <option value="Param3">Parametr3</option>
>
>      </select>
>   <select name="Sistem"  >
>   <option value="">Select a Component:</option>
>   <option value="comp1">Component1</option>
>   <option value="comp2">Component2</option>
>   <option value="comp3">Component3</option>
>  </select>
>   </form>
>
>
>     </head>
>
>     <body>
>          <div id="chart_div" style="width: 500px; height: 500px;"></div>
>
>     </body>
> </html>
>
> how do I pass two values ​​to the function drawChart?
>
> --
> 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
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton 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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to