@@ -8,11 +8,17 @@ const defaultOptions = {
88 * @default : derived from borderColor
99 */
1010 color : undefined ,
11+
1112 /**
1213 * with as number, or as string with pixel (px) ending, or as string with percentage (%) ending
1314 */
1415 width : 10 ,
1516
17+ /**
18+ * lineWidth as number, or as string with pixel (px) ending, or array of such definition
19+ */
20+ lineWidth : 2 ,
21+
1622 /**
1723 * whether the error values are given in absolute values or relative (default)
1824 */
@@ -118,9 +124,10 @@ const ErrorBarsPlugin = {
118124 * @param horizontal orientation
119125 * @private
120126 */
121- _drawErrorBar ( ctx , model , plus , minus , color , width , horizontal ) {
127+ _drawErrorBar ( ctx , model , plus , minus , color , lineWidth , width , horizontal ) {
122128 ctx . save ( ) ;
123129 ctx . strokeStyle = color ;
130+ ctx . lineWidth = lineWidth ;
124131 ctx . beginPath ( ) ;
125132 if ( horizontal ) {
126133 ctx . moveTo ( minus , model . y - width / 2 ) ;
@@ -170,6 +177,7 @@ const ErrorBarsPlugin = {
170177 const vScale = horizontal ? chart . scales [ 'x-axis-0' ] : chart . scales [ 'y-axis-0' ] ;
171178
172179 const errorBarWidths = ( Array . isArray ( options . width ) ? options . width : [ options . width ] ) . map ( ( w ) => this . _computeWidth ( chart , horizontal , w ) ) ;
180+ const errorBarLineWidths = Array . isArray ( options . lineWidth ) ? options . lineWidth : [ options . lineWidth ] ;
173181 const errorBarColors = Array . isArray ( options . color ) ? options . color : [ options . color ] ;
174182
175183
@@ -204,6 +212,7 @@ const ErrorBarsPlugin = {
204212 errorBars . forEach ( ( errorBar , ei ) => {
205213 // error bar data for the barchart bar or point in linechart
206214 const errorBarColor = errorBarColors [ ei % errorBarColors . length ] ? errorBarColors [ ei % errorBarColors . length ] : bar . color ;
215+ const errorBarLineWidth = errorBarLineWidths [ ei % errorBarLineWidths . length ] ;
207216 const errorBarWidth = errorBarWidths [ ei % errorBarWidths . length ] ;
208217
209218 const plusValue = options . absoluteValues ? errorBar . plus : ( value + errorBar . plus ) ;
@@ -212,7 +221,7 @@ const ErrorBarsPlugin = {
212221 const plus = vScale . getPixelForValue ( plusValue ) ;
213222 const minus = vScale . getPixelForValue ( minusValue ) ;
214223
215- this . _drawErrorBar ( ctx , bar , plus , minus , errorBarColor , errorBarWidth , horizontal ) ;
224+ this . _drawErrorBar ( ctx , bar , plus , minus , errorBarColor , errorBarLineWidth , errorBarWidth , horizontal ) ;
216225 } ) ;
217226 } ) ;
218227 } ) ;
0 commit comments