@@ -157,6 +157,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
157
157
if ( isBlank && isHorizontal ) x1 = x0 ;
158
158
if ( isBlank && ! isHorizontal ) y1 = y0 ;
159
159
160
+ var spansHorizontal = isHorizontal && ( x0 !== x1 ) ;
161
+ var spansVertical = ! isHorizontal && ( y0 !== y1 ) ;
162
+
160
163
// in waterfall mode `between` we need to adjust bar end points to match the connector width
161
164
if ( adjustPixel && ! isBlank ) {
162
165
if ( isHorizontal ) {
@@ -191,9 +194,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
191
194
d3 . round ( Math . round ( v ) - offset , 2 ) : v ;
192
195
}
193
196
194
- function expandToVisible ( v , vc , hideZeroSpan ) {
195
- if ( hideZeroSpan && v === vc ) return v ;
196
-
197
+ function expandToVisible ( v , vc ) {
197
198
// if it's not in danger of disappearing entirely,
198
199
// round more precisely
199
200
return Math . abs ( v - vc ) >= 2 ? roundWithLine ( v ) :
@@ -214,10 +215,14 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
214
215
var op = Color . opacity ( mc ) ;
215
216
var fixpx = ( op < 1 || lw > 0.01 ) ? roundWithLine : expandToVisible ;
216
217
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
+ }
221
226
}
222
227
223
228
var sel = transition ( Lib . ensureSingle ( bar , 'path' ) , fullLayout , opts , makeOnCompleteCallback ) ;
0 commit comments