@@ -361,8 +361,8 @@ axes.autoBin = function(data,ax,nbins,is2d) {
361
361
// the size get smaller than the 'nice' rounded down minimum
362
362
// difference between values
363
363
var distinctData = Plotly . Lib . distinctVals ( data ) ,
364
- msexp = Math . pow ( 10 , Math . floor (
365
- Math . log ( distinctData . minDiff ) / Math . LN10 ) ) ,
364
+ msexp = Math . pow ( ax . exponentbase , Math . floor (
365
+ Math . log ( distinctData . minDiff ) / Math . log ( ax . exponentbase ) ) ) ,
366
366
// TODO: there are some date cases where this will fail...
367
367
minSize = msexp * Plotly . Lib . roundUp (
368
368
distinctData . minDiff / msexp , [ 0.9 , 1.9 , 4.9 , 9.9 ] , true ) ;
@@ -792,14 +792,14 @@ axes.tickFirst = function(ax){
792
792
// Log scales: Linear, Digits
793
793
else if ( tType === 'L' ) {
794
794
return Math . log ( sRound (
795
- ( Math . pow ( 10 , r0 ) - tick0 ) / dtNum ) * dtNum + tick0 ) / Math . LN10 ;
795
+ ( Math . pow ( ax . exponentbase , r0 ) - tick0 ) / dtNum ) * dtNum + tick0 ) / Math . log ( ax . exponentbase ) ;
796
796
}
797
797
else if ( tType === 'D' ) {
798
798
var tickset = ( dtick === 'D2' ) ? roundLog2 : roundLog1 ,
799
799
frac = Plotly . Lib . roundUp ( mod ( r0 , 1 ) , tickset , axrev ) ;
800
800
801
801
return Math . floor ( r0 ) +
802
- Math . log ( d3 . round ( Math . pow ( 10 , frac ) , 1 ) ) / Math . LN10 ;
802
+ Math . log ( d3 . round ( Math . pow ( ax . exponentbase , frac ) , 1 ) ) / Math . log ( ax . exponentbase ) ;
803
803
}
804
804
else throw 'unrecognized dtick ' + String ( dtick ) ;
805
805
} ;
@@ -946,31 +946,32 @@ function formatDate(ax, out, hover, extraPrecision) {
946
946
947
947
function formatLog ( ax , out , hover , extraPrecision , hideexp ) {
948
948
var dtick = ax . dtick ,
949
+ base = ax . exponentbase ,
949
950
x = out . x ;
950
951
if ( extraPrecision && ( ( typeof dtick !== 'string' ) || dtick . charAt ( 0 ) !== 'L' ) ) dtick = 'L3' ;
951
952
952
953
if ( ax . tickformat || ( typeof dtick === 'string' && dtick . charAt ( 0 ) === 'L' ) ) {
953
- out . text = numFormat ( Math . pow ( 10 , x ) , ax , hideexp , extraPrecision ) ;
954
+ out . text = numFormat ( Math . pow ( base , x ) , ax , hideexp , extraPrecision ) ;
954
955
}
955
956
else if ( isNumeric ( dtick ) || ( ( dtick . charAt ( 0 ) === 'D' ) && ( mod ( x + 0.01 , 1 ) < 0.1 ) ) ) {
956
957
if ( [ 'e' , 'E' , 'power' ] . indexOf ( ax . exponentformat ) !== - 1 ) {
957
958
var p = Math . round ( x ) ;
958
959
if ( p === 0 ) out . text = 1 ;
959
- else if ( p === 1 ) out . text = '10' ;
960
- else if ( p > 1 ) out . text = '10 <sup>' + p + '</sup>' ;
961
- else out . text = '10 <sup>\u2212' + - p + '</sup>' ;
960
+ else if ( p === 1 ) out . text = base ;
961
+ else if ( p > 1 ) out . text = base + ' <sup>' + p + '</sup>' ;
962
+ else out . text = base + ' <sup>\u2212' + - p + '</sup>' ;
962
963
963
964
out . fontSize *= 1.25 ;
964
965
}
965
966
else {
966
- out . text = numFormat ( Math . pow ( 10 , x ) , ax , '' , 'fakehover' ) ;
967
+ out . text = numFormat ( Math . pow ( base , x ) , ax , '' , 'fakehover' ) ;
967
968
if ( dtick === 'D1' && ax . _id . charAt ( 0 ) === 'y' ) {
968
969
out . dy -= out . fontSize / 6 ;
969
970
}
970
971
}
971
972
}
972
973
else if ( dtick . charAt ( 0 ) === 'D' ) {
973
- out . text = String ( Math . round ( Math . pow ( 10 , mod ( x , 1 ) ) ) ) ;
974
+ out . text = String ( Math . round ( Math . pow ( base , mod ( x , 1 ) ) ) ) ;
974
975
out . fontSize *= 0.75 ;
975
976
}
976
977
else throw 'unrecognized dtick ' + String ( dtick ) ;
0 commit comments