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 <canvas id='chart' width="{{ width }}" height="{{ height }}"></canvas> |
| 12 </template> |
| 13 <script> |
| 14 Polymer({ |
| 15 table: null, |
| 16 options: null, |
| 17 observe: { |
| 18 options: 'updateChart', |
| 19 table: 'updateChart' |
| 20 }, |
| 21 updateChart: function() { |
| 22 if (this.table == null || this.options == null) { |
| 23 return; |
| 24 } |
| 25 var ctx = this.$.chart.getContext("2d"); |
| 26 new Chart(ctx).Bar(this.table, this.options); |
| 27 } |
| 28 }); |
| 29 </script> |
| 30 </template> |
OLD | NEW |