Chromium Code Reviews| Index: bug_graphs.html |
| diff --git a/bug_graphs.html b/bug_graphs.html |
| index 003493422c8fad48877ebd939640be76e5dc9266..1c75aee44f2bcfd3b1e09f0e41b4a18463d1a900 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,52 @@ |
| 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; |
| + |
| + function getSomeData() { |
| + } |
|
borenet
2014/03/13 16:19:36
This is empty and looks unused... what's it for?
humper
2014/03/13 16:52:00
It's for making sure you actually reviewed the cod
|
| + |
| + function getBugData(callback) { |
|
epoger
2014/03/13 16:18:07
Please add a comment indicating why this complicat
borenet
2014/03/13 16:20:48
+1
humper
2014/03/13 16:52:00
Done.
|
| + $.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 +61,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 +93,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,7 +133,7 @@ |
| font-family: Verdana, Arial, Helvetica, sans-serif; |
| } |
| </style> |
| - |
| + |
| <title>Skia bug motivator</title> |
| </head> |
| <body> |