@@ -503,6 +503,10 @@ axes.prepTicks = function(ax) {
503
503
ax . tick0 = ( ax . type === 'date' ) ? '2000-01-01' : 0 ;
504
504
}
505
505
506
+ // ensure we don't try to make ticks below our minimum precision
507
+ // see https://github.com/plotly/plotly.js/issues/2892
508
+ if ( ax . type === 'date' && ax . dtick < 0.1 ) ax . dtick = 0.1 ;
509
+
506
510
// now figure out rounding of tick values
507
511
autoTickRound ( ax ) ;
508
512
} ;
@@ -692,9 +696,6 @@ axes.autoTicks = function(ax, roughDTick) {
692
696
base = getBase ( 10 ) ;
693
697
ax . dtick = roundDTick ( roughDTick , base , roundBase10 ) ;
694
698
}
695
- // ensure we don't try to make ticks below our minimum precision
696
- // see https://github.com/plotly/plotly.js/issues/2892
697
- if ( ax . dtick < 0.1 ) ax . dtick = 0.1 ;
698
699
}
699
700
else if ( ax . type === 'log' ) {
700
701
ax . tick0 = 0 ;
@@ -788,6 +789,11 @@ function autoTickRound(ax) {
788
789
// of all possible ticks - so take the max. length of tick0 and the next one
789
790
var tick1len = ax . l2r ( tick0ms + dtick ) . replace ( / ^ - / , '' ) . length ;
790
791
ax . _tickround = Math . max ( tick0len , tick1len ) - 20 ;
792
+
793
+ // We shouldn't get here... but in case there's a situation I'm
794
+ // not thinking of where tick0str and tick1str are identical or
795
+ // something, fall back on maximum precision
796
+ if ( ax . _tickround < 0 ) ax . _tickround = 4 ;
791
797
}
792
798
}
793
799
else if ( isNumeric ( dtick ) || dtick . charAt ( 0 ) === 'L' ) {
0 commit comments