| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <link rel="import" href="../lib/dygraph.html"> | 7 <link rel="import" href="../lib/dygraph.html"> |
| 8 <link rel="import" href="../lib/log.html"> | 8 <link rel="import" href="../lib/log.html"> |
| 9 <link rel="import" href="../model/patch-summary.html"> | 9 <link rel="import" href="../model/patch-summary.html"> |
| 10 <link rel="import" href="../model/patch-summary-list.html"> | 10 <link rel="import" href="../model/patch-summary-list.html"> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 underlayCallback: this._onGraphDrawUnderlay.bind(this), | 74 underlayCallback: this._onGraphDrawUnderlay.bind(this), |
| 75 }); | 75 }); |
| 76 // Overwrite default white legend background to be translucent. | 76 // Overwrite default white legend background to be translucent. |
| 77 var legend = this.$.graphDiv.querySelector('.dygraph-legend'); | 77 var legend = this.$.graphDiv.querySelector('.dygraph-legend'); |
| 78 legend.style.backgroundColor = 'rgba(255, 255, 255, 0.8)'; | 78 legend.style.backgroundColor = 'rgba(255, 255, 255, 0.8)'; |
| 79 }, | 79 }, |
| 80 _onGraphClick: function() { | 80 _onGraphClick: function() { |
| 81 if (!this._dygraph || !this.graph.data.rowItemsAvailable) { | 81 if (!this._dygraph || !this.graph.data.rowItemsAvailable) { |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 this._patchSummaryList.list = []; | 84 this._patchSummaryList.clear(); |
| 85 var row = this._dygraph.getSelection(); | 85 var row = this._dygraph.getSelection(); |
| 86 if (row !== -1) { | 86 if (row !== -1) { |
| 87 this._loading = true; | 87 this._loading = true; |
| 88 var self = this; | 88 var self = this; |
| 89 this.graph.data.rowItems(row).then(function(rowItems) { | 89 this.graph.data.rowItems(row).then(function(rowItems) { |
| 90 self._loading = false; | 90 self._loading = false; |
| 91 self._patchSummaryList.list = rowItems.items.map(function(item) { | 91 self._patchSummaryList.set(rowItems.begin, rowItems.end, |
| 92 rowItems.items.map(function(item) { |
| 92 var itemValue = item[0]; | 93 var itemValue = item[0]; |
| 93 var itemRef = item[1]; | 94 var itemRef = item[1]; |
| 94 return new PatchSummary(itemValue, self.graph.itemUnit, | 95 return new PatchSummary(itemValue, self.graph.itemUnit, |
| 95 itemRef.issue, itemRef.patchset, | 96 itemRef.issue, itemRef.patchset, |
| 96 self.graph.itemAlertThreshold); | 97 self.graph.itemAlertThreshold); |
| 97 }); | 98 })); |
| 98 self._patchSummaryList.begin = rowItems.begin; | |
| 99 self._patchSummaryList.end = rowItems.end; | |
| 100 }).catch(log); | 99 }).catch(log); |
| 101 } | 100 } |
| 102 }, | 101 }, |
| 103 _onGraphDrawUnderlay: function(context, area, dygraph) { | 102 _onGraphDrawUnderlay: function(context, area, dygraph) { |
| 104 var self = this; | 103 var self = this; |
| 105 Object.keys(this.graph.alerts, function(col, threshold) { | 104 Object.keys(this.graph.alerts, function(col, threshold) { |
| 106 self.graph.breachedItems(col, threshold).then(function(items) { | 105 self.graph.breachedItems(col, threshold).then(function(items) { |
| 107 context.strokeStyle = 'red'; | 106 context.strokeStyle = 'red'; |
| 108 context.lineWidth = 5; | 107 context.lineWidth = 5; |
| 109 context.lineCap = 'round'; | 108 context.lineCap = 'round'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 130 var unit = this.graph.unit; | 129 var unit = this.graph.unit; |
| 131 Object.keys(this.graph.alerts, function(col, threshold) { | 130 Object.keys(this.graph.alerts, function(col, threshold) { |
| 132 items.push('{1} ≥ {2} {3}'.assign(col, threshold, unit)); | 131 items.push('{1} ≥ {2} {3}'.assign(col, threshold, unit)); |
| 133 }); | 132 }); |
| 134 return items.join(', '); | 133 return items.join(', '); |
| 135 }, | 134 }, |
| 136 }); | 135 }); |
| 137 })(); | 136 })(); |
| 138 </script> | 137 </script> |
| 139 </polymer-element> | 138 </polymer-element> |
| OLD | NEW |