Fixed bug in singlestat panel and null value handling, #2189

This commit is contained in:
Torkel Ödegaard 2015-06-19 11:51:46 -04:00
parent 388fba4569
commit 261e5ebbd4
2 changed files with 7 additions and 1 deletions

View File

@ -406,6 +406,7 @@ function($, _, moment) {
kbn.valueFormats.velocityknot = function(value, decimals) { return kbn.toFixed(value, decimals) + ' kn'; };
kbn.roundValue = function (num, decimals) {
if (num === null) { return null; }
var n = Math.pow(10, decimals);
return Math.round((n * num).toFixed(decimals)) / n;
};

View File

@ -51,7 +51,12 @@ define([
});
});
describe('kbn roundValue', function() {
it('should should handle null value', function() {
var str = kbn.roundValue(null, 2);
expect(str).to.be(null);
});
});
describe('calculateInterval', function() {
it('1h 100 resultion', function() {