mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(singlestat gauge): better font size handling for gauge, now value font size is used as scaling factor, fixes #4876
This commit is contained in:
@@ -42,6 +42,8 @@ export class GrafanaApp {
|
|||||||
app.constant('grafanaVersion', "@grafanaVersion@");
|
app.constant('grafanaVersion', "@grafanaVersion@");
|
||||||
|
|
||||||
app.config(($locationProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) => {
|
app.config(($locationProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) => {
|
||||||
|
//$compileProvider.debugInfoEnabled(false);
|
||||||
|
|
||||||
this.registerFunctions.controller = $controllerProvider.register;
|
this.registerFunctions.controller = $controllerProvider.register;
|
||||||
this.registerFunctions.directive = $compileProvider.directive;
|
this.registerFunctions.directive = $compileProvider.directive;
|
||||||
this.registerFunctions.factory = $provide.factory;
|
this.registerFunctions.factory = $provide.factory;
|
||||||
|
|||||||
@@ -324,9 +324,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 +374,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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user