@@ -74,7 +74,9 @@ function autoScaleRangeX(scale, dimensions) {
74
74
if ( scale . range === undefined ) {
75
75
const { insetLeft, insetRight} = scale ;
76
76
const { width, marginLeft = 0 , marginRight = 0 } = dimensions ;
77
- scale . range = [ marginLeft + insetLeft , width - marginRight - insetRight ] ;
77
+ const left = marginLeft + insetLeft ;
78
+ const right = width - marginRight - insetRight ;
79
+ scale . range = [ left , Math . max ( left , right ) ] ;
78
80
if ( ! isOrdinalScale ( scale ) ) scale . range = piecewiseRange ( scale ) ;
79
81
scale . scale . range ( scale . range ) ;
80
82
}
@@ -85,7 +87,9 @@ function autoScaleRangeY(scale, dimensions) {
85
87
if ( scale . range === undefined ) {
86
88
const { insetTop, insetBottom} = scale ;
87
89
const { height, marginTop = 0 , marginBottom = 0 } = dimensions ;
88
- scale . range = [ height - marginBottom - insetBottom , marginTop + insetTop ] ;
90
+ const top = marginTop + insetTop ;
91
+ const bottom = height - marginBottom - insetBottom ;
92
+ scale . range = [ Math . max ( top , bottom ) , top ] ;
89
93
if ( ! isOrdinalScale ( scale ) ) scale . range = piecewiseRange ( scale ) ;
90
94
else scale . range . reverse ( ) ;
91
95
scale . scale . range ( scale . range ) ;
0 commit comments