Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Subtract rounding increment when using toFixed
  • Loading branch information
camdecoster committed Jun 23, 2026
commit bc032db643b45af853ab1e510cb89fa59b34278e
4 changes: 3 additions & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,9 @@ function numFormat(v, ax, fmtoverride, hover) {
v = v.slice(0, Math.max(0, v.length + tickRound));
for(var i = tickRound; i < 0; i++) v += '0';
} else {
v = v.toFixed(Math.max(0, Math.min(20, tickRound))).replace(/\.?0+$/, '');
// subtract the half-epsilon added above so toFixed doesn't double-round
v -= e;
v = v.toFixed(Math.min(20, tickRound)).replace(/\.?0+$/, '');
}
// insert appropriate decimal point and thousands separator
v = Lib.numSeparate(v, ax._separators, separatethousands);
Expand Down
Loading