This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for horizontalBar chart [51]
added chart-horizontal-bar for horizontal bar charts
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<link rel="import" href="../polymer/polymer.html"> | ||
<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html"> | ||
<link rel="import" href="chart-js-import.html"> | ||
<link rel="import" href="chart-property-behavior.html"> | ||
<link rel="import" href="context-behavior.html"> | ||
<link rel="import" href="resize-behavior.html"> | ||
|
||
<!-- | ||
A bar chart is a way of showing data as bars. | ||
It is sometimes used to show trend data, and the comparison of multiple data sets side by side. | ||
##### Example | ||
<chart-horizontal-bar data="[[data]]"></chart-horizontal-bar> | ||
... | ||
this.data = { | ||
labels: ["January", "February", "March", "April", "May", "June", "July"], | ||
datasets: [ | ||
{ | ||
label: "My First dataset", | ||
backgroundColor: "rgba(220,220,220,0.2)", | ||
borderColor: "rgba(220,220,220,1)", | ||
borderWidth: 1, | ||
data: [65, 59, 80, 81, 56, 55, 40] | ||
}, | ||
{ | ||
label: "My Second dataset", | ||
backgroundColor: "rgba(151,187,205,0.2)", | ||
borderColor: "rgba(151,187,205,1)", | ||
borderWidth: 1, | ||
data: [28, 48, 40, 19, 86, 27, 90] | ||
} | ||
] | ||
}; | ||
@group Chart Elements | ||
@element chart-bar | ||
@demo demo/chart-bar.html | ||
--> | ||
|
||
<link rel="import" href="chart-styles.html"> | ||
<dom-module id="chart-horizontal-bar"> | ||
|
||
<template> | ||
|
||
<style include="chart-styles"></style> | ||
|
||
<div> | ||
<canvas id="canvas"></canvas> | ||
</div> | ||
|
||
</template> | ||
|
||
<script> | ||
Polymer({ | ||
|
||
is: 'chart-horizontal-bar', | ||
|
||
behaviors: [ | ||
Polymer.IronResizableBehavior, | ||
ChartBehaviors.ChartPropertyBehavior, | ||
ChartBehaviors.ContextBehavior, | ||
ChartBehaviors.ResizeBehavior | ||
], | ||
|
||
ready: function() { | ||
this._setType('horizontalBar'); | ||
} | ||
|
||
}); | ||
</script> | ||
|
||
</dom-module> |