| Index: bug_graphs.html
|
| diff --git a/bug_graphs.html b/bug_graphs.html
|
| index 003493422c8fad48877ebd939640be76e5dc9266..7da18359a655c47097ba7ff0fc9931662de59177 100644
|
| --- a/bug_graphs.html
|
| +++ b/bug_graphs.html
|
| @@ -1,6 +1,6 @@
|
| <html>
|
| <head>
|
| - <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
| + <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
| <script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
| <script type="text/javascript">
|
| var url = "https://www.googleapis.com/projecthosting/v2/projects/skia/issues";
|
| @@ -8,32 +8,57 @@
|
| var ph_params = {
|
| sort: 'items(published)',
|
| fields: 'items(published,closed),totalResults',
|
| - maxResults: 99999,
|
| + maxResults: 9999,
|
| key: 'AIzaSyDq0bq2zkLR1WfmmGihHU6Vf6nG4msE-io',
|
| + startIndex: 0
|
| };
|
|
|
| google.load('visualization', '1', {packages:['corechart']});
|
| google.setOnLoadCallback( drawChart );
|
| -
|
| +
|
| + all_items = [];
|
| + var totalResults;
|
| +
|
| + // The bug database API may not return all the requested bugs in a single call.
|
| + // (data.totalResults will return the total number of bugs that meet the
|
| + // request parameters, but data.items may only include a subset.)
|
| + // Keep calling back to the API, and appending results to all_items, until
|
| + // we get as many results as promised in data.totalResults (which is,
|
| + // of course, actually a 1-indexed array index for the last value, not the
|
| + // actual number of results. Hence the minus-ones.
|
| +
|
| + function getBugData(callback) {
|
| + $.get( url, ph_params, function( data ) {
|
| + totalResults = data.totalResults
|
| + all_items = all_items.concat(data.items);
|
| + $("#stats").text("Received " + all_items.length +
|
| + " total Skia bugs of " + (totalResults-1) + "." );
|
| + if (all_items.length == totalResults - 1) {
|
| + callback();
|
| + } else {
|
| + ph_params['startIndex'] = all_items.length + 1;
|
| + getBugData(callback);
|
| + }
|
| + });
|
| + }
|
|
|
| function drawChart() {
|
| var bug_data = [];
|
| -
|
| - $.get( url, ph_params, function( data ) {
|
|
|
| + getBugData(function() {
|
|
|
| - /* Data comes back from the Project Hosting API in JSON format like:
|
| + /* Data comes back from the Project Hosting API in JSON format like:
|
|
|
| {
|
| - "totalResults": 1057,
|
| - "items": [
|
| + "totalResults": 1057,
|
| + "items": [
|
| {
|
| - "published": "2008-12-23T18:57:06.000Z",
|
| - "closed": "2009-04-23T17:12:54.000Z"
|
| + "published": "2008-12-23T18:57:06.000Z",
|
| + "closed": "2009-04-23T17:12:54.000Z"
|
| },
|
| {
|
| - "published": "2008-12-23T18:58:08.000Z",
|
| - "closed": "2010-04-15T17:28:52.000Z"
|
| + "published": "2008-12-23T18:58:08.000Z",
|
| + "closed": "2010-04-15T17:28:52.000Z"
|
| },
|
| ...
|
| }
|
| @@ -41,21 +66,21 @@
|
| if the bug is still open, there will simply not be a 'closed'
|
| attribute on the item.
|
|
|
| - */
|
| -
|
| + */
|
| +
|
|
|
| - // turn this into a list of [ date, +1/-1 ] pairs indicating
|
| + // turn this into a list of [ date, +1/-1 ] pairs indicating
|
| // whether or not we added or subtracted a bug on that day.
|
| // Need this intermediate step because the list of actions
|
| // are only sorted on publication date, but the close date
|
| // can be any time in the future.
|
|
|
| actions = [];
|
| - for (var i = 0 ; i < data.items.length; i++) {
|
| - var publish = new Date(data.items[i].published);
|
| + for (var i = 0 ; i < all_items.length; i++) {
|
| + var publish = new Date(all_items[i].published);
|
| actions.push( [publish, 1] );
|
| - if (data.items[i].closed ) {
|
| - var closed = new Date(data.items[i].closed);
|
| + if (all_items[i].closed ) {
|
| + var closed = new Date(all_items[i].closed);
|
| actions.push( [closed,-1] );
|
| }
|
| }
|
| @@ -73,39 +98,39 @@
|
| bug_count += actions[i][1];
|
| bug_data.push( {c: [{v: actions[i][0]}, {v: bug_count}]} );
|
| }
|
| - $("#stats").text("Found " + data.totalResults +
|
| - " total Skia bugs, with " + bug_count +
|
| - " remaining open." );
|
| -
|
| + $("#stats").text("Found " + (totalResults-1) +
|
| + " total Skia bugs, with " + bug_count +
|
| + " remaining open." );
|
| +
|
| var data_table_init = {
|
| 'cols': [
|
| - {
|
| - 'label': 'Time',
|
| + {
|
| + 'label': 'Time',
|
| 'type': 'datetime'
|
| - },
|
| - {
|
| - 'label': 'Number of open Skia bugs',
|
| + },
|
| + {
|
| + 'label': 'Number of open Skia bugs',
|
| 'type': 'number'
|
| }
|
| ],
|
| 'rows': bug_data
|
| };
|
| -
|
| +
|
| var data_table = new google.visualization.DataTable(data_table_init);
|
|
|
| var options = {
|
| - 'title': 'Number of open Skia bugs',
|
| - 'width': 1024,
|
| + 'title': 'Number of open Skia bugs',
|
| + 'width': 1024,
|
| 'height': 768
|
| };
|
| -
|
| +
|
| var graph_container = document.getElementById('graph');
|
| var graph = new google.visualization.LineChart(graph_container);
|
| graph.draw(data_table,options);
|
| });
|
| }
|
| </script>
|
| -
|
| +
|
| <style>
|
| body {
|
| font-size: 24pt;
|
| @@ -113,13 +138,13 @@
|
| font-family: Verdana, Arial, Helvetica, sans-serif;
|
| }
|
| </style>
|
| -
|
| +
|
| <title>Skia bug motivator</title>
|
| </head>
|
| <body>
|
| <div id="results_wrapper">
|
| - Retrieving Skia bug information...
|
| - <div id="stats"></div>
|
| + Open Skia bugs over time
|
| + <div id="stats">Gettings bugs, please wait...</div>
|
| <div id="graph"></div>
|
| </div>
|
| </body>
|
|
|