Fix singlestat threshold tooltip (#12109)

fix singlestat threshold tooltip
This commit is contained in:
Patrick O'Carroll 2018-05-30 18:09:57 +02:00 committed by Marcus Efraimsson
parent b379b28337
commit b894b5e669
2 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,7 @@
<div class="gf-form-inline">
<div class="gf-form max-width-21">
<label class="gf-form-label width-8">Thresholds
<tip>Define two threshold values&lt;br /&gt; 50,80 will produce: &lt;50 = Green, 50:80 = Yellow, &gt;80 = Red</tip>
<tip>Define two threshold values&lt;br /&gt; 50,80 will produce: value &lt; 50 = Green, 50 &lt;= value &lt; 80 = Yellow, value &gt;= 80 = Red</tip>
</label>
<input type="text" class="gf-form-input" ng-model="ctrl.panel.thresholds" ng-blur="ctrl.render()" placeholder="50,80"></input>
</div>

View File

@ -714,11 +714,13 @@ function getColorForValue(data, value) {
if (!_.isFinite(value)) {
return null;
}
for (var i = data.thresholds.length; i > 0; i--) {
if (value >= data.thresholds[i - 1]) {
return data.colorMap[i];
}
}
return _.first(data.colorMap);
}