diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 38a8a7a8909..3307f7358e7 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -2210,9 +2210,7 @@ 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 = String(v); - var dp = v.indexOf('.') + 1; - if(dp) v = v.slice(0, dp + tickRound).replace(/\.?0+$/, ''); + v = v.toFixed(Math.max(0, Math.min(20, tickRound))).replace(/\.?0+$/, ''); } // insert appropriate decimal point and thousands separator v = Lib.numSeparate(v, ax._separators, separatethousands);