Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 1d1a57d

Browse files
author
sluger
committed
Merge branch 'master' of github.com:datavisyn/chartjs-plugin-error-bars
2 parents 378311c + dda5afb commit 1d1a57d

1 file changed

Lines changed: 94 additions & 4 deletions

File tree

README.md

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,101 @@
1-
# chartjs-plugin-error-bars
2-
Error Bars Chart.js Plugin
1+
# Chart.js Error Bars Plugin
2+
[![datavisyn][datavisyn-image]][datavisyn-url] [![NPM Package][npm-image]][npm-url] [![CircleCI][circleci-image]][circleci-url]
3+
4+
[Chart.js](http://www.chartjs.org/) plugin for adding error bars to Line-, Barcharts or hierarchical Barcharts. This plugin also works with the [Hierarchical Scale Plugin](https://github.com/datavisyn/chartjs-scale-hierarchical).
5+
6+
![selection_037](https://user-images.githubusercontent.com/5220584/43774415-4ab5ae88-9a49-11e8-813d-48d607d45225.png)
7+
![selection_038](https://user-images.githubusercontent.com/5220584/43774418-4d08132e-9a49-11e8-9e90-723ef91783c7.png)
8+
![selection_039](https://user-images.githubusercontent.com/5220584/43774420-4e7d7546-9a49-11e8-8cc9-67c63de96081.png)
9+
10+
## Install
11+
```bash
12+
npm install --save chart.js chartjs-plugin-error-bars
13+
```
14+
15+
## Usage
16+
Datasets must define an `errorBars` object that contains the error bar property key (same as in the used scale) and values `plus` and `minus`. Plus values are always positive, and minus vice versa.
17+
18+
*Categorical scale usage:*
19+
```javascript
20+
data: {
21+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
22+
datasets: [{
23+
...
24+
errorBars: {
25+
'February': {plus: 15, minus: -34},
26+
'March': {plus: 5, minus: -24},
27+
'May': {plus: 35, minus: -14},
28+
'June': {plus: 45, minus: -4}
29+
}, ...
30+
```
31+
32+
*Hierarchical scale plugin usage:*
33+
```javascript
34+
data: {
35+
labels: [
36+
'A',
37+
{
38+
label: 'C1',
39+
children: ['C1.1', 'C1.2', 'C1.3', 'C1.4']
40+
}
41+
],
42+
datasets: [{
43+
...
44+
errorBars: {
45+
'A': {plus: 25, minus: -10},
46+
'C1.2': {plus: 14, minus: -15},
47+
'C1': {plus: 34, minus: -5}
48+
}, ...
49+
}
50+
```
51+
52+
Find more [Samples](https://github.com/datavisyn/chartjs-plugin-error-bars/tree/master/samples) on Github.
53+
54+
55+
## Options
56+
```javascript
57+
options: {
58+
...
59+
60+
plugins: {
61+
chartJsPluginErrorBars: {
62+
/**
63+
* stroke color
64+
* @default: derived from borderColor
65+
*/
66+
color: '#666'
67+
68+
/**
69+
* bar width in pixel as number or string or bar width in percent based on the barchart bars width (max 100%)
70+
* @default 10
71+
*/
72+
width: 10 | '10px' | '60%'
73+
}
74+
}
75+
76+
...
77+
}
78+
```
79+
80+
81+
## Building
82+
83+
```sh
84+
npm install
85+
npm run build
86+
```
387
4-
> in development
588
689
***
790
891
<div style="display:flex;align-items:center">
992
<a href="http://datavisyn.io"><img src="https://user-images.githubusercontent.com/1711080/37700685-bcbb18c6-2cec-11e8-9b6f-f49c9ef6c167.png" align="left" width="50px" hspace="10" vspace="6"></a>
10-
Developed by&nbsp;<strong><a href="http://datavisyn.io">datavisyn</a></strong>.
93+
Developed by &nbsp;<strong><a href="http://datavisyn.io">datavisyn</a></strong>.
1194
</div>
95+
96+
[datavisyn-image]: https://img.shields.io/badge/datavisyn-io-black.svg
97+
[datavisyn-url]: http://datavisyn.io
98+
[npm-image]: https://badge.fury.io/js/chartjs-plugin-error-bars.svg
99+
[npm-url]: https://npmjs.org/package/chartjs-plugin-error-bars
100+
[circleci-image]: https://circleci.com/gh/datavisyn/chartjs-plugin-error-bars.svg?style=shield
101+
[circleci-url]: https://circleci.com/gh/datavisyn/chartjs-plugin-error-bars

0 commit comments

Comments
 (0)