Difference between revisions of "Web Element: Google Chart"


Line 1: Line 1:
<html>
 
<head>
 
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 
    <script type="text/javascript">
 
function drawChart() {
 
  var query = new google.visualization.Query('https://docs.google.com/spreadsheets/d/1YUqF27YsO2tVdFL1R6Oxu5BT5itjA_ozZDrekzfFclk/gviz/tq?range=A1:C4');
 
  query.send(handleQueryResponse);
 
}
 
 
function handleQueryResponse(response) {
 
  var data = response.getDataTable();
 
  var chart = new google.visualization.ScatterChart(document.getElementById('chart_div_3'));
 
  chart.draw(data, null);
 
}
 
    </script>
 
</head>
 
<body>
 
<div id="chart_div_3"></div>
 
</body>
 
</html>
 
 
 
<html>
 
<html>
 
   <head>
 
   <head>
Line 30: Line 9:
 
         var wrapper = new google.visualization.ChartWrapper({
 
         var wrapper = new google.visualization.ChartWrapper({
 
           chartType: 'LineChart',
 
           chartType: 'LineChart',
//          dataSourceUrl: 'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1',
+
          dataSourceUrl: 'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1',
//          query: 'SELECT A,D WHERE D > 100 ORDER BY D',
+
          query: 'SELECT A,D WHERE D > 100 ORDER BY D',
//          options: {'title': 'Countries'},
+
          options: {'title': 'Countries'},
          dataSourceUrl: 'http://spreadsheets.google.com/tq?key=1YUqF27YsO2tVdFL1R6Oxu5BT5itjA_ozZDrekzfFclk&pub=1&range=A1:C4',
 
 
           containerId: 'vis_div'
 
           containerId: 'vis_div'
 
         });
 
         });

Revision as of 13:30, 28 April 2020