Commit 27c536b1 by Torkel Ödegaard

Small fix to 'none' axis formats and zero value when axis tickDecimals is high, Closes #707

parent dc5973a0
...@@ -536,7 +536,7 @@ function($, _, moment) { ...@@ -536,7 +536,7 @@ function($, _, moment) {
var formatted = String(Math.round(value * factor) / factor); var formatted = String(Math.round(value * factor) / factor);
// if exponent return directly // if exponent return directly
if (formatted.indexOf('e') !== -1) { if (formatted.indexOf('e') !== -1 || value === 0) {
return formatted; return formatted;
} }
......
...@@ -27,6 +27,10 @@ define([ ...@@ -27,6 +27,10 @@ define([
var str = kbn.getFormatFunction('')(2.75e-10, { tickDecimals: 12 }); var str = kbn.getFormatFunction('')(2.75e-10, { tickDecimals: 12 });
expect(str).to.be('2.75e-10'); expect(str).to.be('2.75e-10');
}); });
it('should format 0 correctly', function() {
var str = kbn.getFormatFunction('')(0.0, { tickDecimals: 12 });
expect(str).to.be('0');
});
}); });
describe('none format tests', function() { describe('none format tests', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment