| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 <!-- | 6 <!-- |
| 7 This in an HTML Import-able file that contains the definition | 7 This in an HTML Import-able file that contains the definition |
| 8 of the following elements: | 8 of the following elements: |
| 9 | 9 |
| 10 <partial-line-chart> | 10 <partial-line-chart> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 names: Array<String>, the names of the data columns to show. If blank, | 22 names: Array<String>, the names of the data columns to show. If blank, |
| 23 all will be shown. | 23 all will be shown. |
| 24 title: String, the title of the line graph. | 24 title: String, the title of the line graph. |
| 25 | 25 |
| 26 Methods: | 26 Methods: |
| 27 None. | 27 None. |
| 28 | 28 |
| 29 Events: | 29 Events: |
| 30 None. | 30 None. |
| 31 --> | 31 --> |
| 32 <link rel="import" href="/imp/bower_components/google-chart/google-chart.html"> | 32 <link rel="import" href="/res/imp/bower_components/google-chart/google-chart.htm
l"> |
| 33 | 33 |
| 34 <dom-module id="partial-line-chart"> | 34 <dom-module id="partial-line-chart"> |
| 35 <style> | 35 <style> |
| 36 google-chart { | 36 google-chart { |
| 37 width: 100%; | 37 width: 100%; |
| 38 height: 250px; | 38 height: 250px; |
| 39 } | 39 } |
| 40 </style> | 40 </style> |
| 41 <template> | 41 <template> |
| 42 | 42 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 "title": title, | 79 "title": title, |
| 80 "animation": { | 80 "animation": { |
| 81 "duration": 500, | 81 "duration": 500, |
| 82 "easing": "out" | 82 "easing": "out" |
| 83 }, | 83 }, |
| 84 "legend": {"position": "bottom"} | 84 "legend": {"position": "bottom"} |
| 85 }; | 85 }; |
| 86 }, | 86 }, |
| 87 | 87 |
| 88 trimData: function() { | 88 trimData: function() { |
| 89 console.log(this.all_data); | |
| 90 var table = new google.visualization.DataTable(this.all_data); | 89 var table = new google.visualization.DataTable(this.all_data); |
| 91 if (!this.names || this.names.length === 0) { | 90 if (!this.names || this.names.length === 0) { |
| 92 return JSON.parse(table.toJSON()); | 91 return JSON.parse(table.toJSON()); |
| 93 } | 92 } |
| 94 | 93 |
| 95 var view = new google.visualization.DataView(table); | 94 var view = new google.visualization.DataView(table); |
| 96 | 95 |
| 97 var colsToShow = [0]; | 96 var colsToShow = [0]; |
| 98 var cols = this.all_data.cols; | 97 var cols = this.all_data.cols; |
| 99 for (var i = 1;i < cols.length; i++) { | 98 for (var i = 1;i < cols.length; i++) { |
| 100 if (this.names.indexOf(cols[i].id) !== -1) { | 99 if (this.names.indexOf(cols[i].id) !== -1) { |
| 101 colsToShow.push(i); | 100 colsToShow.push(i); |
| 102 } | 101 } |
| 103 } | 102 } |
| 104 | 103 |
| 105 view.setColumns(colsToShow); | 104 view.setColumns(colsToShow); |
| 106 return JSON.parse(view.toDataTable().toJSON()); | 105 return JSON.parse(view.toDataTable().toJSON()); |
| 107 }, | 106 }, |
| 108 }); | 107 }); |
| 109 })(); | 108 })(); |
| 110 </script> | 109 </script> |
| 111 </dom-module> | 110 </dom-module> |
| OLD | NEW |