diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts
index d0fa3c3183e..3272323c354 100644
--- a/public/app/plugins/panel/singlestat/module.ts
+++ b/public/app/plugins/panel/singlestat/module.ts
@@ -11,6 +11,8 @@ import TimeSeries from 'app/core/time_series2';
import { MetricsPanelCtrl } from 'app/plugins/sdk';
import { GrafanaThemeType, getValueFormat, getColorFromHexRgbOrName, isTableData } from '@grafana/ui';
+const BASE_FONT_SIZE = 38;
+
class SingleStatCtrl extends MetricsPanelCtrl {
static templateUrl = 'module.html';
@@ -384,10 +386,11 @@ class SingleStatCtrl extends MetricsPanelCtrl {
return valueString;
}
- function getSpan(className, fontSize, applyColoring, value) {
+ function getSpan(className, fontSizePercent, applyColoring, value) {
value = $sanitize(templateSrv.replace(value, data.scopedVars));
value = applyColoring ? applyColoringThresholds(value) : value;
- return '' + value + '';
+ const pixelSize = (parseInt(fontSizePercent, 10) / 100) * BASE_FONT_SIZE;
+ return '' + value + '';
}
function getBigValueHtml() {
diff --git a/public/sass/components/_panel_singlestat.scss b/public/sass/components/_panel_singlestat.scss
index 7854ac2093f..df8cbd0c037 100644
--- a/public/sass/components/_panel_singlestat.scss
+++ b/public/sass/components/_panel_singlestat.scss
@@ -6,17 +6,13 @@
}
.singlestat-panel-value-container {
- // line-height 0 is imporant here as the font-size is on this
- // level but overriden one level deeper and but the line-height: is still
- // based on the base font size on this level. Using line-height: 0 fixes that
- line-height: 0;
display: table-cell;
vertical-align: middle;
text-align: center;
position: relative;
z-index: 1;
font-weight: $font-weight-semi-bold;
- font-size: 38px;
+ line-height: 1;
}
// Helps