Skip to content

Commit 9316bcf

Browse files
committed
fix(singlestat): enables autoupdate on change
closes grafana#4809 closes grafana#4812
1 parent 6085564 commit 9316bcf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

public/app/plugins/panel/singlestat/module.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
278278
return body;
279279
}
280280

281+
function getValueText() {
282+
var result = panel.prefix ? panel.prefix : '';
283+
result += data.valueFormated;
284+
result += panel.postfix ? panel.postfix : '';
285+
286+
return result;
287+
}
288+
281289
function addGauge() {
282290
var plotCanvas = $('<div></div>');
283291
var plotCss = {
@@ -332,7 +340,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
332340
},
333341
value: {
334342
color: panel.colorValue ? getColorForValue(data, data.valueRounded) : null,
335-
formatter: function () { return data.valueFormated; },
343+
formatter: function() { return getValueText(); },
336344
font: { size: getGaugeFontSize() }
337345
},
338346
show: true
@@ -419,6 +427,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
419427

420428
function render() {
421429
if (!ctrl.data) { return; }
430+
ctrl.setValues(ctrl.data);
422431
data = ctrl.data;
423432
setElementHeight();
424433

0 commit comments

Comments
 (0)