Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!-- | |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | |
| 3 Use of this source code is governed by a BSD-style license that can be | |
| 4 found in the LICENSE file. | |
| 5 --> | |
| 6 | |
| 7 <link rel="import" href="../lib/chart-loader.html"> | |
| 8 | |
| 9 <polymer-element name="ct-chart" attributes="table options width height"> | |
| 10 <template> | |
| 11 <style> | |
|
ojan
2014/09/05 00:24:47
Don't need this style block in here, right?
shans
2014/09/05 01:44:00
Done.
| |
| 12 #failure { | |
| 13 flex: 1; | |
| 14 margin-left: 10px; | |
| 15 } | |
| 16 | |
| 17 #details { | |
| 18 font-weight: bold; | |
| 19 } | |
| 20 </style> | |
| 21 <canvas id='chart' width="{{ width }}" height="{{ height }}"></canvas> | |
| 22 </template> | |
| 23 <script> | |
| 24 Polymer({ | |
| 25 table: null, | |
| 26 options: null, | |
| 27 optionsChanged: function() { | |
|
ojan
2014/09/05 00:24:47
Use observe for this.
http://www.polymer-project.
ojan
2014/09/05 00:24:47
Use observe for this.
http://www.polymer-project.
shans
2014/09/05 01:44:00
Done.
shans
2014/09/05 01:44:00
Done.
| |
| 28 this.updateChart(); | |
| 29 }, | |
| 30 tableChanged: function() { | |
| 31 this.updateChart(); | |
| 32 }, | |
| 33 updateChart: function() { | |
| 34 if (this.table == null || this.options == null) { | |
| 35 return; | |
| 36 } | |
| 37 var ctx = this.$.chart.getContext("2d"); | |
| 38 new Chart(ctx).Bar(this.table, this.options); | |
| 39 } | |
| 40 }); | |
| 41 </script> | |
| 42 </template> | |
| OLD | NEW |