OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. |
| 6 --> |
| 7 |
| 8 <link rel="import" href="/tracing/ui/base/table.html"> |
| 9 <link rel="import" href="/tracing/value/ui/scalar_span.html"> |
| 10 |
| 11 <dom-module name="tr-v-ui-numeric-stats-span"> |
| 12 <template> |
| 13 <tr-ui-b-table id="stats"></tr-ui-b-table> |
| 14 </template> |
| 15 </dom-module> |
| 16 <script> |
| 17 'use strict'; |
| 18 Polymer({ |
| 19 is: 'tr-v-ui-numeric-stats-span', |
| 20 |
| 21 ready: function() { |
| 22 this.numeric_ = undefined; |
| 23 |
| 24 this.$.stats.showHeader = false; |
| 25 this.$.stats.tableColumns = [ |
| 26 { |
| 27 value: function(row) { |
| 28 return row.name; |
| 29 } |
| 30 }, |
| 31 { |
| 32 align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT, |
| 33 value: function(row) { |
| 34 return tr.v.ui.createScalarSpan(row.value); |
| 35 } |
| 36 } |
| 37 ]; |
| 38 }, |
| 39 |
| 40 get numeric() { |
| 41 return this.numeric_; |
| 42 }, |
| 43 |
| 44 set numeric(n) { |
| 45 this.numeric_ = n; |
| 46 this.updateContents_(); |
| 47 }, |
| 48 |
| 49 updateContents_: function() { |
| 50 var rows = []; |
| 51 if (this.numeric_) { |
| 52 var stats = this.numeric_.getSummarizedScalarNumericsWithNames(); |
| 53 stats.forEach(function(stat) { |
| 54 rows.push({ |
| 55 name: stat.name, |
| 56 value: stat.scalar |
| 57 }); |
| 58 }); |
| 59 } |
| 60 this.$.stats.tableRows = rows; |
| 61 this.$.stats.rebuild(); |
| 62 } |
| 63 }); |
| 64 </script> |
OLD | NEW |