|
@@ -82,7 +82,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onDataError(err) {
|
|
onDataError(err) {
|
|
|
- this.onDataReceived({data: []});
|
|
|
|
|
|
|
+ this.onDataReceived([]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onDataReceived(dataList) {
|
|
onDataReceived(dataList) {
|
|
@@ -91,11 +91,6 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
|
|
var data: any = {};
|
|
var data: any = {};
|
|
|
this.setValues(data);
|
|
this.setValues(data);
|
|
|
|
|
|
|
|
- data.thresholds = this.panel.thresholds.split(',').map(function(strVale) {
|
|
|
|
|
- return Number(strVale.trim());
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- data.colorMap = this.panel.colors;
|
|
|
|
|
this.data = data;
|
|
this.data = data;
|
|
|
this.render();
|
|
this.render();
|
|
|
}
|
|
}
|
|
@@ -324,9 +319,9 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
|
|
? 'rgb(230,230,230)'
|
|
? 'rgb(230,230,230)'
|
|
|
: 'rgb(38,38,38)';
|
|
: 'rgb(38,38,38)';
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var fontScale = parseInt(panel.valueFontSize) / 100;
|
|
|
var dimension = Math.min(width, height);
|
|
var dimension = Math.min(width, height);
|
|
|
- var fontSize = Math.min(dimension/4, 100);
|
|
|
|
|
|
|
+ var fontSize = Math.min(dimension/5, 100) * fontScale;
|
|
|
var gaugeWidth = Math.min(dimension/6, 60);
|
|
var gaugeWidth = Math.min(dimension/6, 60);
|
|
|
var thresholdMarkersWidth = gaugeWidth/5;
|
|
var thresholdMarkersWidth = gaugeWidth/5;
|
|
|
|
|
|
|
@@ -374,15 +369,6 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
|
|
$.plot(plotCanvas, [plotSeries], options);
|
|
$.plot(plotCanvas, [plotSeries], options);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function getGaugeFontSize() {
|
|
|
|
|
- if (panel.valueFontSize) {
|
|
|
|
|
- var num = parseInt(panel.valueFontSize.substring(0, panel.valueFontSize.length - 1));
|
|
|
|
|
- return (30 * (num / 100)) + 15;
|
|
|
|
|
- } else {
|
|
|
|
|
- return 30;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function addSparkline() {
|
|
function addSparkline() {
|
|
|
var width = elem.width() + 20;
|
|
var width = elem.width() + 20;
|
|
|
if (width < 30) {
|
|
if (width < 30) {
|
|
@@ -444,8 +430,14 @@ 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;
|
|
|
|
|
+
|
|
|
|
|
+ // get thresholds
|
|
|
|
|
+ data.thresholds = panel.thresholds.split(',').map(function(strVale) {
|
|
|
|
|
+ return Number(strVale.trim());
|
|
|
|
|
+ });
|
|
|
|
|
+ data.colorMap = panel.colors;
|
|
|
|
|
+
|
|
|
setElementHeight();
|
|
setElementHeight();
|
|
|
|
|
|
|
|
var body = panel.gauge.show ? '' : getBigValueHtml();
|
|
var body = panel.gauge.show ? '' : getBigValueHtml();
|