@@ -251,7 +251,7 @@ function drawColorBar(g, opts, gd) {
251
251
ax . tick0 = levelsIn . start ;
252
252
var dtick = levelsIn . size ;
253
253
// expand if too many contours, so we don't get too many ticks
254
- var autoNtick = Lib . constrain ( ( vPx - ( vPx - lenPx ) ) / 50 , 4 , 15 ) + 1 ;
254
+ var autoNtick = Lib . constrain ( lenPx / 50 , 4 , 15 ) + 1 ;
255
255
var dtFactor = ( zrange [ 1 ] - zrange [ 0 ] ) / ( ( opts . nticks || autoNtick ) * dtick ) ;
256
256
if ( dtFactor > 1 ) {
257
257
var dtexp = Math . pow ( 10 , Math . floor ( Math . log ( dtFactor ) / Math . LN10 ) ) ;
@@ -511,11 +511,11 @@ function drawColorBar(g, opts, gd) {
511
511
}
512
512
513
513
var outerwidth = 2 * xpad + innerWidth + borderwidth + outlinewidth / 2 ;
514
- var outerheight = vPx - ( vPx - lenPx ) ;
514
+ var outerheight = lenPx ;
515
515
516
516
g . select ( '.' + cn . cbbg ) . attr ( {
517
517
x : uPx - xpad - ( borderwidth + outlinewidth ) / 2 ,
518
- y : ( vPx - lenPx ) - yExtraPx ,
518
+ y : vPx - lenPx - yExtraPx ,
519
519
width : Math . max ( outerwidth , 2 ) ,
520
520
height : Math . max ( outerheight + 2 * yExtraPx , 2 )
521
521
} )
@@ -525,7 +525,7 @@ function drawColorBar(g, opts, gd) {
525
525
526
526
g . selectAll ( '.' + cn . cboutline ) . attr ( {
527
527
x : uPx ,
528
- y : ( vPx - lenPx ) + ypad + ( titleSide === 'top' ? titleHeight : 0 ) ,
528
+ y : vPx - lenPx + ypad + ( titleSide === 'top' ? titleHeight : 0 ) ,
529
529
width : Math . max ( thickPx , 2 ) ,
530
530
height : Math . max ( outerheight - 2 * ypad - titleHeight , 2 )
531
531
} )
0 commit comments