|
| 1 | +<link rel="import" href="../polymer/polymer.html"> |
| 2 | +<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html"> |
| 3 | +<link rel="import" href="chart-js-import.html"> |
| 4 | +<link rel="import" href="chart-property-behavior.html"> |
| 5 | +<link rel="import" href="context-behavior.html"> |
| 6 | +<link rel="import" href="resize-behavior.html"> |
| 7 | + |
| 8 | +<!-- |
| 9 | +A bar chart is a way of showing data as bars. |
| 10 | +
|
| 11 | +It is sometimes used to show trend data, and the comparison of multiple data sets side by side. |
| 12 | +
|
| 13 | +##### Example |
| 14 | +
|
| 15 | + <chart-horizontal-bar data="[[data]]"></chart-horizontal-bar> |
| 16 | +
|
| 17 | + ... |
| 18 | +
|
| 19 | + this.data = { |
| 20 | + labels: ["January", "February", "March", "April", "May", "June", "July"], |
| 21 | + datasets: [ |
| 22 | + { |
| 23 | + label: "My First dataset", |
| 24 | + backgroundColor: "rgba(220,220,220,0.2)", |
| 25 | + borderColor: "rgba(220,220,220,1)", |
| 26 | + borderWidth: 1, |
| 27 | + data: [65, 59, 80, 81, 56, 55, 40] |
| 28 | + }, |
| 29 | + { |
| 30 | + label: "My Second dataset", |
| 31 | + backgroundColor: "rgba(151,187,205,0.2)", |
| 32 | + borderColor: "rgba(151,187,205,1)", |
| 33 | + borderWidth: 1, |
| 34 | + data: [28, 48, 40, 19, 86, 27, 90] |
| 35 | + } |
| 36 | + ] |
| 37 | + }; |
| 38 | +
|
| 39 | +@group Chart Elements |
| 40 | +@element chart-bar |
| 41 | +@demo demo/chart-bar.html |
| 42 | +--> |
| 43 | + |
| 44 | +<link rel="import" href="chart-styles.html"> |
| 45 | +<dom-module id="chart-horizontal-bar"> |
| 46 | + |
| 47 | + <template> |
| 48 | + |
| 49 | + <style include="chart-styles"></style> |
| 50 | + |
| 51 | + <div> |
| 52 | + <canvas id="canvas"></canvas> |
| 53 | + </div> |
| 54 | + |
| 55 | + </template> |
| 56 | + |
| 57 | + <script> |
| 58 | + Polymer({ |
| 59 | + |
| 60 | + is: 'chart-horizontal-bar', |
| 61 | + |
| 62 | + behaviors: [ |
| 63 | + Polymer.IronResizableBehavior, |
| 64 | + ChartBehaviors.ChartPropertyBehavior, |
| 65 | + ChartBehaviors.ContextBehavior, |
| 66 | + ChartBehaviors.ResizeBehavior |
| 67 | + ], |
| 68 | + |
| 69 | + ready: function() { |
| 70 | + this._setType('horizontalBar'); |
| 71 | + } |
| 72 | + |
| 73 | + }); |
| 74 | + </script> |
| 75 | + |
| 76 | +</dom-module> |
0 commit comments