@@ -407,28 +407,27 @@ function updatePositionAxis(gd, pa, sieve, allowMinDtick) {
407
407
vpad = minDiff / 2 ;
408
408
409
409
Axes . minDtick ( pa , minDiff , distinctPositions0 , allowMinDtick ) ;
410
- Axes . expand ( pa , distinctPositions , { vpad : vpad } ) ;
411
410
412
411
// if user set bar width or offset,
413
412
// then check whether axis needs expanding
414
- var minPos = Math . min . apply ( Math , distinctPositions ) - vpad ,
415
- maxPos = Math . max . apply ( Math , distinctPositions ) + vpad ,
416
- pMin , pMinOffset , pMinWidth ,
417
- pMax , pMaxOffset , pMaxWidth ;
413
+ var pMin = Math . min . apply ( Math , distinctPositions ) - vpad ,
414
+ pMax = Math . max . apply ( Math , distinctPositions ) + vpad ;
415
+
418
416
for ( var i = 0 ; i < calcTraces . length ; i ++ ) {
419
417
var calcTrace = calcTraces [ i ] ,
420
418
calcTrace0 = calcTrace [ 0 ] ,
421
- fullTrace = calcTrace0 . trace ,
422
- t = calcTrace0 . t ,
423
- poffset = t . poffset ,
424
- poffsetIsArray = Array . isArray ( poffset ) ,
425
- barwidth = t . barwidth ,
426
- barwidthIsArray = Array . isArray ( barwidth ) ;
419
+ fullTrace = calcTrace0 . trace ;
427
420
428
421
if ( fullTrace . width === undefined && fullTrace . offset === undefined ) {
429
422
continue ;
430
423
}
431
424
425
+ var t = calcTrace0 . t ,
426
+ poffset = t . poffset ,
427
+ barwidth = t . barwidth ,
428
+ poffsetIsArray = Array . isArray ( poffset ) ,
429
+ barwidthIsArray = Array . isArray ( barwidth ) ;
430
+
432
431
for ( var j = 0 ; j < calcTrace . length ; j ++ ) {
433
432
var calcBar = calcTrace [ j ] ,
434
433
calcBarOffset = ( poffsetIsArray ) ? poffset [ j ] : poffset ,
@@ -437,29 +436,12 @@ function updatePositionAxis(gd, pa, sieve, allowMinDtick) {
437
436
l = p + calcBarOffset ,
438
437
r = l + calcBarWidth ;
439
438
440
- if ( r >= maxPos ) {
441
- maxPos = r ;
442
- pMax = p ;
443
- pMaxOffset = calcBarOffset ;
444
- pMaxWidth = calcBarWidth ;
445
- }
446
- if ( l <= minPos ) {
447
- minPos = r ;
448
- pMin = p ;
449
- pMinOffset = calcBarOffset ;
450
- pMinWidth = calcBarWidth ;
451
- }
439
+ pMin = Math . min ( pMin , l ) ;
440
+ pMax = Math . max ( pMax , r ) ;
452
441
}
453
442
}
454
443
455
- if ( pMin ) {
456
- vpad = pMinWidth / 2 ;
457
- Axes . expand ( pa , [ pMin + pMinOffset + vpad ] , { vpad : vpad } ) ;
458
- }
459
- if ( pMax ) {
460
- vpad = pMaxWidth / 2 ;
461
- Axes . expand ( pa , [ pMax + pMaxOffset + vpad ] , { vpad : vpad } ) ;
462
- }
444
+ Axes . expand ( pa , [ pMin , pMax ] , { padded : false } ) ;
463
445
}
464
446
465
447
0 commit comments