OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
3 Copyright 2015 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/model/event_set.html"> | |
9 <link rel="import" href="/tracing/ui/base/table.html"> | |
10 <link rel="import" href="/tracing/value/ui/scalar_span.html"> | |
11 <link rel="import" href="/tracing/value/unit.html"> | |
12 | |
13 <dom-module id='tr-ui-a-power-sample-table'> | |
14 <template> | |
15 <style> | |
16 :host { | |
17 display: flex; | |
18 } | |
19 </style> | |
20 <tr-ui-b-table id="table"></tr-ui-b-table> | |
21 </template> | |
22 </dom-module> | |
23 | |
24 <script> | |
25 'use strict'; | |
26 var EventSet = tr.model.EventSet; | |
27 | |
28 Polymer({ | |
29 is: 'tr-ui-a-power-sample-table', | |
30 | |
31 ready: function() { | |
32 this.$.table.tableColumns = [ | |
33 { | |
34 title: 'Time', | |
35 width: '100px', | |
36 value: function(row) { | |
37 return tr.v.ui.createScalarSpan(row.start, { | |
38 unit: tr.v.Unit.byName.timeStampInMs | |
39 }); | |
40 } | |
41 }, | |
42 { | |
43 title: 'Power', | |
44 width: '100%', | |
45 value: function(row) { | |
46 return tr.v.ui.createScalarSpan(row.power, { | |
47 unit: tr.v.Unit.byName.powerInWatts | |
48 }); | |
49 } | |
50 } | |
51 ]; | |
52 this.samples = new EventSet(); | |
53 }, | |
54 | |
55 get samples() { | |
56 return this.samples_; | |
57 }, | |
58 | |
59 set samples(samples) { | |
60 this.samples_ = (samples === undefined) ? new EventSet() : samples; | |
61 this.updateContents_(); | |
62 }, | |
63 | |
64 updateContents_: function() { | |
65 this.$.table.tableRows = this.samples.toArray(); | |
66 this.$.table.rebuild(); | |
67 } | |
68 }); | |
69 </script> | |
OLD | NEW |