@@ -14,6 +14,7 @@ Try the demo on [Codepen](https://codepen.io/sluger/pen/YjJKYy).
1414npm install --save chart.js chartjs-plugin-error-bars
1515```
1616
17+
1718## Usage
1819Datasets 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.
1920
@@ -29,6 +30,29 @@ Datasets must define an `errorBars` object that contains the error bar property
2930 ' May' : {plus: 35 , minus: - 14 },
3031 ' June' : {plus: 45 , minus: - 4 }
3132 }, ...
33+
34+ /* or for graded error bars
35+
36+ errorBars: {
37+ 'February': [{plus: 15, minus: -34}, {plus: 10, minus: -26}],
38+ 'March': [{plus: 5, minus: -24}, {plus: 2, minus: -16}],
39+ 'May': [{plus: 35, minus: -14}, {plus: 7, minus: -7}],
40+ 'June': [{plus: 45, minus: -4}, {plus: 25, minus: -2}]
41+ }, ...
42+
43+ */
44+ ` ` `
45+
46+ corresponding TypeScript interface
47+ ` ` ` ts
48+ interface IErrorBars {
49+ [label: string]: IErrorBar | IErrorBar[];
50+ }
51+
52+ interface IErrorBar {
53+ plus: number;
54+ minus: number;
55+ }
3256` ` `
3357
3458*Hierarchical scale plugin usage:*
@@ -62,13 +86,13 @@ Find more [Samples](https://github.com/datavisyn/chartjs-plugin-error-bars/tree/
6286 plugins: {
6387 chartJsPluginErrorBars: {
6488 /**
65- * stroke color
89+ * stroke color, or array of colors
6690 * @default : derived from borderColor
6791 */
6892 color: ' #666' ,
6993
7094 /**
71- * bar width in pixel as number or string or bar width in percent based on the barchart bars width (max 100%)
95+ * bar width in pixel as number or string or bar width in percent based on the barchart bars width (max 100%), or array of such definition
7296 * @default 10
7397 */
7498 width: 10 | ' 10px' | ' 60%' ,
@@ -78,6 +102,12 @@ Find more [Samples](https://github.com/datavisyn/chartjs-plugin-error-bars/tree/
78102 */
79103 lineWidth: 2 | ' 2px' ,
80104
105+ /**
106+ * lineWidth as number, or as string with pixel (px) ending, or array of such definition
107+ * @default 2
108+ */
109+ lineWidth: 2 | ' 2px' ,
110+
81111 /**
82112 * whether to interpet the plus/minus values, relative to the value itself (default) or absolute
83113 * @default false
@@ -90,6 +120,16 @@ Find more [Samples](https://github.com/datavisyn/chartjs-plugin-error-bars/tree/
90120}
91121` ` `
92122
123+ corresponding TypeScript interface
124+ ` ` ` ts
125+ interface IChartJsPluginErrorBarsOptions {
126+ color: string | string[];
127+ width: (string | number) | (string | number)[];
128+ lineWidth: (string | number) | (string | number)[];
129+ absoluteValues: boolean;
130+ }
131+ ` ` `
132+
93133
94134## Building
95135
0 commit comments