Difference between revisions of "Web Element: Data"


 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{|
 +
| width=50% |
 
<html>
 
<html>
 
   <head>
 
   <head>
Line 78: Line 80:
 
                 },
 
                 },
 
          1: {type: 'bars', color: 'black'},},
 
          1: {type: 'bars', color: 'black'},},
//        'width':600,
+
//        'width':300,
           'height':400,
+
           'height':300,
 
//        crosshair: { trigger: 'both', opacity: 0.5 },
 
//        crosshair: { trigger: 'both', opacity: 0.5 },
 
//        trendlines: { 1: {} }    // Draw a trendline for data series 1,
 
//        trendlines: { 1: {} }    // Draw a trendline for data series 1,
Line 94: Line 96:
 
</body>
 
</body>
 
</html>
 
</html>
 
+
|
  
 
<html>
 
<html>
Line 167: Line 169:
 
           vAxis: {title: 'Daily cases', scaleType: 'log'},
 
           vAxis: {title: 'Daily cases', scaleType: 'log'},
 
           legend: 'none',
 
           legend: 'none',
           'height':400,
+
           'height':300,
 
         };
 
         };
  
Line 181: Line 183:
 
</body>
 
</body>
 
</html>
 
</html>
 
+
|}
https://docs.google.com/spreadsheets/d/1YUqF27YsO2tVdFL1R6Oxu5BT5itjA_ozZDrekzfFclk/edit?usp=sharing
 
 
 
<html>
 
<body>
 
  <button id="authorize-button" style="visibility: hidden">Authorize</button>
 
  <script type="text/javascript">
 
// NOTE: You must replace the client id on the following line.
 
var clientId = '549821307845-9ef2xotqflhcqbv10.apps.googleusercontent.com';
 
var scopes = 'https://www.googleapis.com/auth/spreadsheets';
 
function init() {
 
  gapi.auth.authorize(
 
      {client_id: clientId, scope: scopes, immediate: true},
 
      handleAuthResult);
 
}
 
function handleAuthResult(authResult) {
 
  var authorizeButton = document.getElementById('authorize-button');
 
  if (authResult && !authResult.error) {
 
    authorizeButton.style.visibility = 'hidden';
 
    makeApiCall();
 
  } else {
 
    authorizeButton.style.visibility = '';
 
    authorizeButton.onclick = handleAuthClick;
 
  }
 
}
 
function handleAuthClick(event) {
 
  gapi.auth.authorize(
 
      {client_id: clientId, scope: scopes, immediate: false},
 
      handleAuthResult);
 
  return false;
 
}
 
function makeApiCall() {
 
  // Note: The below spreadsheet is "Public on the web" and will work
 
  // with or without an OAuth token.  For a better test, replace this
 
  // URL with a private spreadsheet.
 
  var tqUrl = 'https://docs.google.com/spreadsheets' +
 
      '/d/1XWJLkAwch5GXAt_7zOFDcg8Wm8Xv29_8PWuuW15qmAE/gviz/tq' +
 
      '?tqx=responseHandler:handleTqResponse' +
 
      '&access_token=' + encodeURIComponent(gapi.auth.getToken().access_token);
 
  document.write('<script src="' + tqUrl +'" type="text/javascript"></script>');
 
}
 
function handleTqResponse(resp) {
 
  document.write(JSON.stringify(resp));
 
}
 
  </script>
 
  <script src="https://apis.google.com/js/auth.js?onload=init"></script>
 
</body>
 
</html>
 

Latest revision as of 12:34, 17 May 2020