13. <html> <head> <!--Load the AJAX API--> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> // Load the Visualization API and the piechart package. google.load('visualization', '1', {'packages':['piechart']}); // Set a callback to run when the API is loaded. google.setOnLoadCallback(drawChart); // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it. function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Activity'); data.addColumn('number', 'Percentage of Time Spent'); data.addRows(3); data.setValue(0, 0, 'Joking about it on twitter'); data.setValue(0, 1, 80); data.setValue(1, 0, 'Writing code'); data.setValue(1, 1, 10); data.setValue(2, 0, 'Presenting to my dogs'); data.setValue(2, 1, 10); var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data, {width: 800, height: 600, is3D: true, title: 'Time Jason Spent Preparing For This Presentation'}); } </script> </head> <body> <!--Div that will hold the pie chart--> <div id="chart_div"></div> </body> </html>
14.
15.
16.
17.
18.
19.
20. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Hourly Activity - eXtension People</title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["columnchart"]}); google.setOnLoadCallback(queryData); function queryData() { var query = new google.visualization.Query('https://people.extension.org/data/activitytable?activity=aaeresolve&tz=US%2FEastern'); query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); var chart = new google.visualization.ColumnChart(document.getElementById('visualization_chart')); chart.draw(data, {width: 800, height: 480, legend: 'bottom', title: ''}); } </script> </head> <body> <h1>Hourly Activity</h1> <div id="visualization_chart"></div> </body> </html>