mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
Fixed bug in singlestat panel and null value handling, #2189
This commit is contained in:
parent
388fba4569
commit
261e5ebbd4
@ -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;
|
||||
};
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user