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

Skip to content

Commit 84c4b55

Browse files
committed
Fixed log type errors on plot values (incorrect exponent bases)
1 parent 851ad63 commit 84c4b55

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/plots/cartesian/axes.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -951,33 +951,33 @@ function formatDate(ax, out, hover, extraPrecision) {
951951

952952
function formatLog(ax, out, hover, extraPrecision, hideexp) {
953953
var dtick = ax.dtick,
954-
base = ax.exponentbase || 10,
954+
exponentbase = ax.exponentbase || 10,
955955
x = out.x;
956956
if(extraPrecision && ((typeof dtick !== 'string') || dtick.charAt(0)!=='L')) dtick = 'L3';
957957

958958
if(ax.tickformat || (typeof dtick === 'string' && dtick.charAt(0) === 'L')) {
959-
out.text = numFormat(Math.pow(base, x), ax, hideexp, extraPrecision);
959+
out.text = numFormat(Math.pow(exponentbase, x), ax, hideexp, extraPrecision);
960960
}
961961
else if(isNumeric(dtick)||((dtick.charAt(0)==='D')&&(mod(x+0.01,1)<0.1))) {
962962
if(['e','E','power'].indexOf(ax.exponentformat)!==-1) {
963-
base = base === Math.E ? 'e' : base;
963+
exponentbase = exponentbase === Math.E ? 'e' : exponentbase;
964964
var p = Math.round(x);
965965
if(p === 0) out.text = '1';
966-
else if(p === 1) out.text = String(base);
967-
else if(p > 1) out.text = base + '<sup>' + p + '</sup>';
968-
else out.text = base + '<sup>\u2212' + -p + '</sup>';
966+
else if(p === 1) out.text = String(exponentbase);
967+
else if(p > 1) out.text = exponentbase + '<sup>' + p + '</sup>';
968+
else out.text = exponentbase + '<sup>\u2212' + -p + '</sup>';
969969

970970
out.fontSize *= 1.25;
971971
}
972972
else {
973-
out.text = numFormat(Math.pow(base,x), ax,'','fakehover');
973+
out.text = numFormat(Math.pow(exponentbase, x), ax,'','fakehover');
974974
if(dtick==='D1' && ax._id.charAt(0)==='y') {
975975
out.dy -= out.fontSize/6;
976976
}
977977
}
978978
}
979979
else if(dtick.charAt(0) === 'D') {
980-
out.text = String(Math.round(Math.pow(base, mod(x, 1))));
980+
out.text = String(Math.round(Math.pow(exponentbase, mod(x, 1))));
981981
out.fontSize *= 0.75;
982982
}
983983
else throw 'unrecognized dtick ' + String(dtick);

0 commit comments

Comments
 (0)