From 0c6841bdc77639d7a8bc25071269be648bb0a75c Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 19 Apr 2016 14:44:29 +0200 Subject: [PATCH] fix(singlestat): adds support for fontsizes in gagues --- public/app/plugins/panel/singlestat/module.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index 19909f08441..c8ebd0b0561 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -328,7 +328,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { value: { color: panel.colorValue ? getColorForValue(data, data.valueRounded) : null, formatter: function () { return data.valueFormated; }, - font: { size: 30 } + font: { size: getGaugeFontSize() } }, show: true } @@ -344,6 +344,15 @@ class SingleStatCtrl extends MetricsPanelCtrl { $.plot(plotCanvas, [plotSeries], options); } + function getGaugeFontSize() { + if (panel.valueFontSize) { + var num = parseInt(panel.valueFontSize.substring(0, panel.valueFontSize.length - 1)); + return 30 * (num / 100); + } else { + return 30; + } + } + function addSparkline() { var width = elem.width() + 20; if (width < 30) { @@ -405,7 +414,6 @@ class SingleStatCtrl extends MetricsPanelCtrl { function render() { if (!ctrl.data) { return; } - data = ctrl.data; setElementHeight();