mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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.
This commit is contained in:
parent
cb8ecb2d5f
commit
7b768bca3f
@ -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]]}
|
||||
|
2
public/vendor/flot/jquery.flot.gauge.js
vendored
2
public/vendor/flot/jquery.flot.gauge.js
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user