OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // | 5 // |
6 // This file contains helper methods to draw the stats timeline graphs. | 6 // This file contains helper methods to draw the stats timeline graphs. |
7 // Each graph represents a series of stats report for a PeerConnection, | 7 // Each graph represents a series of stats report for a PeerConnection, |
8 // e.g. 1234-0-ssrc-abcd123-bytesSent is the graph for the series of bytesSent | 8 // e.g. 1234-0-ssrc-abcd123-bytesSent is the graph for the series of bytesSent |
9 // for ssrc-abcd123 of PeerConnection 0 in process 1234. | 9 // for ssrc-abcd123 of PeerConnection 0 in process 1234. |
10 // The graphs are drawn as CANVAS, grouped per report type per PeerConnection. | 10 // The graphs are drawn as CANVAS, grouped per report type per PeerConnection. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 graphViews[graphViewId] = createStatsGraphView(peerConnectionElement, | 133 graphViews[graphViewId] = createStatsGraphView(peerConnectionElement, |
134 report, | 134 report, |
135 graphType); | 135 graphType); |
136 var date = new Date(stats.timestamp); | 136 var date = new Date(stats.timestamp); |
137 graphViews[graphViewId].setDateRange(date, date); | 137 graphViews[graphViewId].setDateRange(date, date); |
138 } | 138 } |
139 // Adds the new dataSeries to the graphView. We have to do it here to cover | 139 // Adds the new dataSeries to the graphView. We have to do it here to cover |
140 // both the simple and compound graph cases. | 140 // both the simple and compound graph cases. |
141 if (!graphViews[graphViewId].hasDataSeries(dataSeries[finalDataSeriesId])) | 141 if (!graphViews[graphViewId].hasDataSeries(dataSeries[finalDataSeriesId])) |
142 graphViews[graphViewId].addDataSeries(dataSeries[finalDataSeriesId]); | 142 graphViews[graphViewId].addDataSeries(dataSeries[finalDataSeriesId]); |
| 143 |
143 graphViews[graphViewId].updateEndDate(); | 144 graphViews[graphViewId].updateEndDate(); |
144 } | 145 } |
145 } | 146 } |
146 | 147 |
147 // Makes sure the TimelineDataSeries with id |dataSeriesId| is created, | 148 // Makes sure the TimelineDataSeries with id |dataSeriesId| is created, |
148 // and adds the new data point to it. | 149 // and adds the new data point to it. |
149 function addDataSeriesPoint(dataSeriesId, time, label, value) { | 150 function addDataSeriesPoint(dataSeriesId, time, label, value) { |
150 if (!dataSeries[dataSeriesId]) { | 151 if (!dataSeries[dataSeriesId]) { |
151 dataSeries[dataSeriesId] = new TimelineDataSeries(); | 152 dataSeries[dataSeriesId] = new TimelineDataSeries(); |
152 if (bweCompoundGraphConfig[label]) { | 153 if (bweCompoundGraphConfig[label]) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 div.graphViewId = | 225 div.graphViewId = |
225 peerConnectionElement.id + '-' + reportName + '-bweCompound'; | 226 peerConnectionElement.id + '-' + reportName + '-bweCompound'; |
226 div.firstChild.addEventListener('click', function(event) { | 227 div.firstChild.addEventListener('click', function(event) { |
227 var target = dataSeries[event.target.parentNode.dataSeriesId]; | 228 var target = dataSeries[event.target.parentNode.dataSeriesId]; |
228 target.show(event.target.checked); | 229 target.show(event.target.checked); |
229 graphViews[event.target.parentNode.graphViewId].repaint(); | 230 graphViews[event.target.parentNode.graphViewId].repaint(); |
230 }); | 231 }); |
231 } | 232 } |
232 return legend; | 233 return legend; |
233 } | 234 } |
OLD | NEW |