@@ -157,6 +157,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
157157 if ( isBlank && isHorizontal ) x1 = x0 ;
158158 if ( isBlank && ! isHorizontal ) y1 = y0 ;
159159
160+ var spansHorizontal = isHorizontal && ( x0 !== x1 ) ;
161+ var spansVertical = ! isHorizontal && ( y0 !== y1 ) ;
162+
160163 // in waterfall mode `between` we need to adjust bar end points to match the connector width
161164 if ( adjustPixel && ! isBlank ) {
162165 if ( isHorizontal ) {
@@ -191,9 +194,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
191194 d3 . round ( Math . round ( v ) - offset , 2 ) : v ;
192195 }
193196
194- function expandToVisible ( v , vc , hideZeroSpan ) {
195- if ( hideZeroSpan && v === vc ) return v ;
196-
197+ function expandToVisible ( v , vc ) {
197198 // if it's not in danger of disappearing entirely,
198199 // round more precisely
199200 return Math . abs ( v - vc ) >= 2 ? roundWithLine ( v ) :
@@ -214,10 +215,14 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
214215 var op = Color . opacity ( mc ) ;
215216 var fixpx = ( op < 1 || lw > 0.01 ) ? roundWithLine : expandToVisible ;
216217
217- x0 = fixpx ( x0 , x1 , isHorizontal ) ;
218- x1 = fixpx ( x1 , x0 , isHorizontal ) ;
219- y0 = fixpx ( y0 , y1 , ! isHorizontal ) ;
220- y1 = fixpx ( y1 , y0 , ! isHorizontal ) ;
218+ if ( spansHorizontal ) {
219+ x0 = fixpx ( x0 , x1 ) ;
220+ x1 = fixpx ( x1 , x0 ) ;
221+ }
222+ if ( spansVertical ) {
223+ y0 = fixpx ( y0 , y1 ) ;
224+ y1 = fixpx ( y1 , y0 ) ;
225+ }
221226 }
222227
223228 var sel = transition ( Lib . ensureSingle ( bar , 'path' ) , fullLayout , opts , makeOnCompleteCallback ) ;
0 commit comments