@@ -233,25 +233,26 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) {
233
233
// and the plot itself may decide to cancel (ie non-grouped bars)
234
234
if ( [ 'log' , 'category' , 'multicategory' ] . indexOf ( ax . type ) !== - 1 || ! allow ) {
235
235
ax . _minDtick = 0 ;
236
- }
237
- // undefined means there's nothing there yet
238
- else if ( ax . _minDtick === undefined ) {
236
+ } else if ( ax . _minDtick === undefined ) {
237
+ // undefined means there's nothing there yet
238
+
239
239
ax . _minDtick = newDiff ;
240
240
ax . _forceTick0 = newFirst ;
241
241
} else if ( ax . _minDtick ) {
242
- // existing minDtick is an integer multiple of newDiff
243
- // (within rounding err)
244
- // and forceTick0 can be shifted to newFirst
245
242
if ( ( ax . _minDtick / newDiff + 1e-6 ) % 1 < 2e-6 &&
243
+ // existing minDtick is an integer multiple of newDiff
244
+ // (within rounding err)
245
+ // and forceTick0 can be shifted to newFirst
246
+
246
247
( ( ( newFirst - ax . _forceTick0 ) / newDiff % 1 ) +
247
248
1.000001 ) % 1 < 2e-6 ) {
248
249
ax . _minDtick = newDiff ;
249
250
ax . _forceTick0 = newFirst ;
250
- }
251
- // if the converse is true (newDiff is a multiple of minDtick and
252
- // newFirst can be shifted to forceTick0) then do nothing - same
253
- // forcing stands. Otherwise, cancel forced minimum
254
- else if ( ( newDiff / ax . _minDtick + 1e-6 ) % 1 > 2e-6 ||
251
+ } else if ( ( newDiff / ax . _minDtick + 1e-6 ) % 1 > 2e-6 ||
252
+ // if the converse is true (newDiff is a multiple of minDtick and
253
+ // newFirst can be shifted to forceTick0) then do nothing - same
254
+ // forcing stands. Otherwise, cancel forced minimum
255
+
255
256
( ( ( newFirst - ax . _forceTick0 ) / ax . _minDtick % 1 ) +
256
257
1.000001 ) % 1 > 2e-6 ) {
257
258
ax . _minDtick = 0 ;
@@ -431,17 +432,18 @@ function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) {
431
432
var dataCount = data . length - blankCount ;
432
433
433
434
if ( intcount === dataCount && ax . type !== 'date' ) {
434
- // all integers: if bin size is <1, it's because
435
- // that was specifically requested (large nbins)
436
- // so respect that... but center the bins containing
437
- // integers on those integers
438
435
if ( ax . dtick < 1 ) {
436
+ // all integers: if bin size is <1, it's because
437
+ // that was specifically requested (large nbins)
438
+ // so respect that... but center the bins containing
439
+ // integers on those integers
440
+
439
441
binStart = dataMin - 0.5 * ax . dtick ;
440
- }
441
- // otherwise start half an integer down regardless of
442
- // the bin size, just enough to clear up endpoint
443
- // ambiguity about which integers are in which bins.
444
- else {
442
+ } else {
443
+ // otherwise start half an integer down regardless of
444
+ // the bin size, just enough to clear up endpoint
445
+ // ambiguity about which integers are in which bins.
446
+
445
447
binStart -= 0.5 ;
446
448
if ( binStart + ax . dtick < dataMin ) binStart += ax . dtick ;
447
449
}
@@ -829,9 +831,10 @@ function autoTickRound(ax) {
829
831
ax . _tickexponent = 3 * Math . round ( ( rangeexp - 1 ) / 3 ) ;
830
832
} else ax . _tickexponent = rangeexp ;
831
833
}
834
+ } else {
835
+ // D1 or D2 (log)
836
+ ax . _tickround = null ;
832
837
}
833
- // D1 or D2 (log)
834
- else ax . _tickround = null ;
835
838
}
836
839
837
840
// months and years don't have constant millisecond values
@@ -915,10 +918,9 @@ axes.tickFirst = function(ax) {
915
918
}
916
919
Lib . error ( 'tickFirst did not converge' , ax ) ;
917
920
return t0 ;
918
- }
921
+ } else if ( tType === 'L' ) {
922
+ // Log scales: Linear, Digits
919
923
920
- // Log scales: Linear, Digits
921
- else if ( tType === 'L' ) {
922
924
return Math . log ( sRound (
923
925
( Math . pow ( 10 , r0 ) - tick0 ) / dtNum ) * dtNum + tick0 ) / Math . LN10 ;
924
926
} else if ( tType === 'D' ) {
0 commit comments