Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4eea120

Browse files
committed
Set default exponentbase for when called externally
1 parent 973c3d1 commit 4eea120

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/plots/cartesian/axes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,8 @@ axes.autoBin = function(data,ax,nbins,is2d) {
11161116
// piggyback off autotick code to make "nice" bin sizes
11171117
var dummyax = {
11181118
type: ax.type==='log' ? 'linear' : ax.type,
1119-
range:[datamin, datamax]
1119+
range:[datamin, datamax],
1120+
exponentbase: ax.exponentbase
11201121
};
11211122
axes.autoTicks(dummyax, size0);
11221123
var binstart = axes.tickIncrement(
@@ -1392,9 +1393,11 @@ axes.autoTicks = function(ax, roughDTick){
13921393
ax.dtick = Math.ceil(Math.max(roughDTick, 1));
13931394
}
13941395
else{
1396+
// Set default in case it's not set from an external call.
1397+
var exponentbase = ax.exponentbase ? ax.exponentbase : 10;
13951398
// auto ticks always start at 0 and increment
13961399
ax.tick0 = 0;
1397-
base = Math.pow(ax.exponentbase, Math.floor(Math.log(roughDTick) / Math.log(ax.exponentbase)));
1400+
base = Math.pow(exponentbase, Math.floor(Math.log(roughDTick) / Math.log(exponentbase)));
13981401
ax.dtick = roundDTick(roughDTick, base, roundBase10);
13991402
}
14001403

0 commit comments

Comments
 (0)