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

This commit is contained in:
Torkel Ödegaard 2014-08-18 09:03:25 +02:00
parent dc5973a0f3
commit 27c536b1a1
2 changed files with 5 additions and 1 deletions

View File

@ -536,7 +536,7 @@ function($, _, moment) {
var formatted = String(Math.round(value * factor) / factor);
// if exponent return directly
if (formatted.indexOf('e') !== -1) {
if (formatted.indexOf('e') !== -1 || value === 0) {
return formatted;
}

View File

@ -27,6 +27,10 @@ define([
var str = kbn.getFormatFunction('')(2.75e-10, { tickDecimals: 12 });
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() {