| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 # Copyright 2015 The LUCI Authors. All rights reserved. | |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | |
| 4 # that can be found in the LICENSE file. | |
| 5 | |
| 6 --> | |
| 7 | |
| 8 <!-- | |
| 9 @group Swarming Elements | |
| 10 | |
| 11 `stats-work-chart' encapsulates a 'google-chart' element and data formating | |
| 12 logic specific for Shards Activity chart of the Swarming statistics app. | |
| 13 This element exposes a 'data' attribute which is a JSON serialized | |
| 14 `google.visualization.DataTable` object and a `resolution` attribute that is | |
| 15 'minutes', 'hours', or 'days'. | |
| 16 | |
| 17 Example: | |
| 18 <stats-work-chart data="{{data_table}}"></stats-work-chart> | |
| 19 | |
| 20 @element stats-work-chart | |
| 21 --> | |
| 22 | |
| 23 <link rel="import" href="bower_components/polymer/polymer.html"> | |
| 24 <link rel="import" href="stats-chart-base.html"> | |
| 25 | |
| 26 <polymer-element name="stats-work-chart" extends="stats-chart-base" attributes="
data resolution isDimension"> | |
| 27 <script> | |
| 28 Polymer('stats-work-chart', { | |
| 29 isDimension: false, | |
| 30 titleText: 'Shards Activity', | |
| 31 | |
| 32 populate: function() { | |
| 33 this.resetFormattedData(); | |
| 34 | |
| 35 // These indexes are relative to stats_gviz._Summary.ORDER. | |
| 36 this.getKeyFormatter().format(this.dataTable, 0); | |
| 37 | |
| 38 var view = new google.visualization.DataView(this.dataTable); | |
| 39 if (this.isDimension) { | |
| 40 view.setColumns([0, 1, 2, 9, 10]); | |
| 41 } else { | |
| 42 view.setColumns([0, 3, 4, 11, 12]); | |
| 43 } | |
| 44 | |
| 45 this.attachView(view); | |
| 46 } | |
| 47 }); | |
| 48 </script> | |
| 49 </polymer-element> | |
| OLD | NEW |