Commit 7b768bca by Daniel Lee

singlestat: change threshold check in flot gauge

Fixes #5515. Flot gauge has its own threshold check that is different
from the threshold check in singlestat. This changes the flot check to
be exclusive (same as the singlestat check). E.g. if the threshold is
10, then the value 10 is over the threshold.
parent cb8ecb2d
......@@ -14,11 +14,27 @@ describe('grafanaSingleStat', function() {
expect(getColorForValue(data, 5)).to.be('green');
});
it('25 should return green', () => {
it('19.9 should return green', () => {
expect(getColorForValue(data, 19.9)).to.be('green');
});
it('20 should return yellow', () => {
expect(getColorForValue(data, 20)).to.be('yellow');
});
it('20.1 should return yellow', () => {
expect(getColorForValue(data, 20.1)).to.be('yellow');
});
it('25 should return yellow', () => {
expect(getColorForValue(data, 25)).to.be('yellow');
});
it('55 should return green', () => {
it('50 should return red', () => {
expect(getColorForValue(data, 50)).to.be('red');
});
it('55 should return red', () => {
expect(getColorForValue(data, 55)).to.be('red');
});
});
......
......@@ -108,7 +108,7 @@ describe('SingleStatCtrl', function() {
});
});
singleStatScenario('When range to text mapping is specifiedfor first range', function(ctx) {
singleStatScenario('When range to text mapping is specified for first range', function(ctx) {
ctx.setup(function() {
ctx.data = [
{target: 'test.cpu1', datapoints: [[41,50]]}
......
......@@ -371,7 +371,7 @@
for (var i = 0; i < gaugeOptionsi.threshold.values.length; i++) {
var threshold = gaugeOptionsi.threshold.values[i];
color = threshold.color;
if (data <= threshold.value) {
if (data < threshold.value) {
break;
}
}
......
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