Hi all.

We've written our own simple data sources to return internal stats
then that we then visualize. The problem is that if we make a second
data source call in the same page, the data is loaded into all the
visualizations, replacing the data from the first call. Here's the
code, simplified a bit:

<head>
    <script type="text/javascript" src="http://www.google.com/jsapi";></
script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:
["corechart","table"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var query = new google.visualization.Query('/php/top.php');
        query.setQuery('top');
        query.send(function(result) {
          if(result.isError()) {
            alert(result.getDetailedMessage());
          } else {
            var chart = new
google.visualization.PieChart(document.getElementById('chart1_div'));
            chart.draw(result.getDataTable(), {idth: 700, height:
400});
          }
        });
        var query2 = new google.visualization.Query('/php/
bottom.php');
        query2.setQuery('bottom');
        query2.send(function(result2) {
        if(result.isError()) {
            alert(result2.getDetailedMessage());
        } else {
            var area = new
google.visualization.AreaChart(document.getElementById('chart2_div'));
            area.draw(result2.getDataTable(), {width: 700, height:
240});
        }
        });*/
        }
    </script>
  </head>

  <body>
    <div id="chart1_div"></div>
    <div id="chart2_div"></div>
  </body>

I've obviously missed something obvious, because both charts end up
being drawn with the data from the second data source, although the
first chart works fine if I comment out the second.

What have I missed? Many thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to google-visualization-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-visualization-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to