Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Commit 085ae52

Browse files
authored
Adding support for horizontalBar chart [51]
added chart-horizontal-bar for horizontal bar charts
2 parents bbcdb21 + a35100d commit 085ae52

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

chart-elements.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<link rel="import" href="chart-bar.html">
22
<link rel="import" href="chart-doughnut.html">
3+
<link rel="import" href="chart-horizontal-bar.html">
34
<link rel="import" href="chart-line.html">
45
<link rel="import" href="chart-pie.html">
56
<link rel="import" href="chart-polar-area.html">

chart-horizontal-bar.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

Comments
 (0)