File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ Vertical or horizontal lines are supported.
4545 // Data value to draw the line at
4646 value: 25 ,
4747
48+ // Optional value at which the line draw should end
49+ endValue: 26 ,
50+
4851 // Line color
4952 borderColor: ' red' ,
5053
Original file line number Diff line number Diff line change @@ -32,17 +32,22 @@ module.exports = function(Chart) {
3232
3333 var scale = chartInstance . scales [ options . scaleID ] ;
3434 var pixel = scale ? scale . getPixelForValue ( options . value ) : NaN ;
35+ var endPixel = scale && isValid ( options . endValue ) ? scale . getPixelForValue ( options . endValue ) : NaN ;
36+ if ( isNaN ( endPixel ) )
37+ endPixel = pixel ;
3538 var chartArea = chartInstance . chartArea ;
3639
3740 if ( ! isNaN ( pixel ) ) {
3841 if ( options . mode == horizontalKeyword ) {
3942 model . x1 = chartArea . left ;
4043 model . x2 = chartArea . right ;
41- model . y1 = model . y2 = pixel ;
44+ model . y1 = pixel ;
45+ model . y2 = endPixel ;
4246 } else {
4347 model . y1 = chartArea . top ;
4448 model . y2 = chartArea . bottom ;
45- model . x1 = model . x2 = pixel ;
49+ model . x1 = pixel ;
50+ model . x2 = endPixel ;
4651 }
4752 }
4853
You can’t perform that action at this time.
0 commit comments