| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 var dataSeries = {}; | 81 var dataSeries = {}; |
| 82 | 82 |
| 83 // Adds the stats report |singleReport| to the timeline graph for the given | 83 // Adds the stats report |singleReport| to the timeline graph for the given |
| 84 // |peerConnectionElement| and |reportName|. | 84 // |peerConnectionElement| and |reportName|. |
| 85 function drawSingleReport(peerConnectionElement, reportName, singleReport) { | 85 function drawSingleReport(peerConnectionElement, reportName, singleReport) { |
| 86 if (!singleReport || !singleReport.values) | 86 if (!singleReport || !singleReport.values) |
| 87 return; | 87 return; |
| 88 for (var i = 0; i < singleReport.values.length - 1; i = i + 2) { | 88 for (var i = 0; i < singleReport.values.length - 1; i = i + 2) { |
| 89 var rawLabel = singleReport.values[i]; | 89 var rawLabel = singleReport.values[i]; |
| 90 var rawValue = parseInt(singleReport.values[i + 1]); | 90 var rawValue = parseInt(singleReport.values[i + 1]); |
| 91 if (isNaN(rawValue)) |
| 92 return; |
| 93 |
| 91 var rawDataSeriesId = | 94 var rawDataSeriesId = |
| 92 peerConnectionElement.id + '-' + reportName + '-' + rawLabel; | 95 peerConnectionElement.id + '-' + reportName + '-' + rawLabel; |
| 93 | 96 |
| 94 var finalDataSeriesId = rawDataSeriesId; | 97 var finalDataSeriesId = rawDataSeriesId; |
| 95 var finalLabel = rawLabel; | 98 var finalLabel = rawLabel; |
| 96 var finalValue = rawValue; | 99 var finalValue = rawValue; |
| 97 // We need to convert the value if dataConversionConfig[rawLabel] exists. | 100 // We need to convert the value if dataConversionConfig[rawLabel] exists. |
| 98 if (dataConversionConfig[rawLabel]) { | 101 if (dataConversionConfig[rawLabel]) { |
| 99 // Updates the original dataSeries before the conversion. | 102 // Updates the original dataSeries before the conversion. |
| 100 addDataSeriesPoint(rawDataSeriesId, singleReport.timestamp, | 103 addDataSeriesPoint(rawDataSeriesId, singleReport.timestamp, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 div.graphViewId = | 214 div.graphViewId = |
| 212 peerConnectionElement.id + '-' + reportName + '-bweCompound'; | 215 peerConnectionElement.id + '-' + reportName + '-bweCompound'; |
| 213 div.firstChild.addEventListener('click', function(event) { | 216 div.firstChild.addEventListener('click', function(event) { |
| 214 var target = dataSeries[event.target.parentNode.dataSeriesId]; | 217 var target = dataSeries[event.target.parentNode.dataSeriesId]; |
| 215 target.show(event.target.checked); | 218 target.show(event.target.checked); |
| 216 graphViews[event.target.parentNode.graphViewId].repaint(); | 219 graphViews[event.target.parentNode.graphViewId].repaint(); |
| 217 }); | 220 }); |
| 218 } | 221 } |
| 219 return legend; | 222 return legend; |
| 220 } | 223 } |
| OLD | NEW |