mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Small fix to 'none' axis formats and zero value when axis tickDecimals is high, Closes #707
This commit is contained in:
parent
dc5973a0f3
commit
27c536b1a1
@ -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([
|
|||||||
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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user