Using Sheets in Google Charts

33 views
Skip to first unread message

J Johnson

unread,
Sep 16, 2015, 9:08:25 PM9/16/15
to Google Visualization API
I am trying to use Google Charts to add to a website for my company, and am running into problems when connecting the Sheet.  I started from the basics and tried to recreate the pie example in the tutorial, but have the chart load the data from a sheet, rather than creating the table in the code.  I am clearly doing something wrong.  When I look at the console, it reads:

 Error while parsing the 'sandbox' attribute: 'allow-popups-to-escape-sandbox' is an invalid sandbox flag.

Do I not have something set up correctly?

I know this is probably a very basic question, but I am just starting out and would appreciate help.  Here is my code:


<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      google.load('visualization', '1.0', {'packages':['corechart']});

      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      
      function drawChart() {
  query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
  var data = response.getDataTable();

}
      
 
        var options = {'title':'How Many Donuts I Ate',
                       'width':400,
                       'height':300};

        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      
    </script>
  </head>

  <body>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>

Reply all
Reply to author
Forward
0 new messages