Commit 9316bcf3 by bergquist

fix(singlestat): enables autoupdate on change

closes #4809
closes #4812
parent 60855643
...@@ -278,6 +278,14 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -278,6 +278,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
return body; return body;
} }
function getValueText() {
var result = panel.prefix ? panel.prefix : '';
result += data.valueFormated;
result += panel.postfix ? panel.postfix : '';
return result;
}
function addGauge() { function addGauge() {
var plotCanvas = $('<div></div>'); var plotCanvas = $('<div></div>');
var plotCss = { var plotCss = {
...@@ -332,7 +340,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -332,7 +340,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
}, },
value: { value: {
color: panel.colorValue ? getColorForValue(data, data.valueRounded) : null, color: panel.colorValue ? getColorForValue(data, data.valueRounded) : null,
formatter: function () { return data.valueFormated; }, formatter: function() { return getValueText(); },
font: { size: getGaugeFontSize() } font: { size: getGaugeFontSize() }
}, },
show: true show: true
...@@ -419,6 +427,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -419,6 +427,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
function render() { function render() {
if (!ctrl.data) { return; } if (!ctrl.data) { return; }
ctrl.setValues(ctrl.data);
data = ctrl.data; data = ctrl.data;
setElementHeight(); setElementHeight();
......
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