@@ -250,6 +250,7 @@ axes.handleTickDefaults = function(containerIn, containerOut, coerce, axType, op
250
250
if ( ! tickFormat && axType !== 'date' ) {
251
251
coerce ( 'showexponent' , showAttrDflt ) ;
252
252
coerce ( 'exponentformat' ) ;
253
+ coerce ( 'exponentbase' ) ;
253
254
}
254
255
}
255
256
@@ -1387,9 +1388,9 @@ axes.autoTicks = function(ax, roughDTick){
1387
1388
ax . dtick = Math . ceil ( Math . max ( roughDTick , 1 ) ) ;
1388
1389
}
1389
1390
else {
1390
- // auto ticks always start at 0
1391
+ // auto ticks always start at 0 and increment
1391
1392
ax . tick0 = 0 ;
1392
- base = Math . pow ( 10 , Math . floor ( Math . log ( roughDTick ) / Math . LN10 ) ) ;
1393
+ base = Math . pow ( ax . exponentbase , Math . floor ( Math . log ( roughDTick ) / Math . log ( ax . exponentbase ) ) ) ;
1393
1394
ax . dtick = roundDTick ( roughDTick , base , roundBase10 ) ;
1394
1395
}
1395
1396
@@ -1750,12 +1751,13 @@ function formatLinear(ax, out, hover, extraPrecision, hideexp) {
1750
1751
// also automatically switch to sci. notation
1751
1752
var SIPREFIXES = [ 'f' , 'p' , 'n' , 'μ' , 'm' , '' , 'k' , 'M' , 'G' , 'T' ] ;
1752
1753
function numFormat ( v , ax , fmtoverride , hover ) {
1753
- // negative?
1754
+ // negative?
1754
1755
var isNeg = v < 0 ,
1755
1756
// max number of digits past decimal point to show
1756
1757
tickRound = ax . _tickround ,
1757
1758
exponentFormat = fmtoverride || ax . exponentformat || 'B' ,
1758
1759
exponent = ax . _tickexponent ,
1760
+ base = ax . exponentbase || 10 ,
1759
1761
tickformat = ax . tickformat ;
1760
1762
1761
1763
// special case for hover: set exponent just for this value, and
@@ -1764,6 +1766,7 @@ function numFormat(v, ax, fmtoverride, hover) {
1764
1766
// make a dummy axis obj to get the auto rounding and exponent
1765
1767
var ah = {
1766
1768
exponentformat :ax . exponentformat ,
1769
+ exponentbase : ax . exponentbase ,
1767
1770
dtick : ax . showexponent === 'none' ? ax . dtick :
1768
1771
( isNumeric ( v ) ? Math . abs ( v ) || 1 : 1 ) ,
1769
1772
// if not showing any exponents, don't change the exponent
0 commit comments