@@ -54,7 +54,8 @@ class SingleStatCtrl extends MetricsPanelCtrl {
54
54
show : false ,
55
55
minValue : 0 ,
56
56
maxValue : 100 ,
57
- thresholdLabels : true
57
+ thresholdMarkers : true ,
58
+ thresholdLabels : false
58
59
}
59
60
} ;
60
61
@@ -295,12 +296,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
295
296
}
296
297
297
298
var plotCanvas = $ ( '<div></div>' ) ;
299
+ var width = elem . width ( ) ;
300
+ var height = elem . height ( ) ;
298
301
var plotCss = {
299
302
top : '10px' ,
300
303
margin : 'auto' ,
301
304
position : 'relative' ,
302
- height : ( elem . height ( ) * 0.9 ) + 'px' ,
303
- width : elem . width ( ) + 'px'
305
+ height : ( height * 0.9 ) + 'px' ,
306
+ width : width + 'px'
304
307
} ;
305
308
306
309
plotCanvas . css ( plotCss ) ;
@@ -321,6 +324,12 @@ class SingleStatCtrl extends MetricsPanelCtrl {
321
324
? 'rgb(230,230,230)'
322
325
: 'rgb(38,38,38)' ;
323
326
327
+
328
+ var dimension = Math . min ( width , height ) ;
329
+ var fontSize = Math . min ( dimension / 4 , 100 ) ;
330
+ var gaugeWidth = Math . min ( dimension / 6 , 60 ) ;
331
+ var thresholdMarkersWidth = gaugeWidth / 5 ;
332
+
324
333
var options = {
325
334
series : {
326
335
gauges : {
@@ -330,11 +339,11 @@ class SingleStatCtrl extends MetricsPanelCtrl {
330
339
background : { color : bgColor } ,
331
340
border : { color : null } ,
332
341
shadow : { show : false } ,
333
- width : 38
342
+ width : gaugeWidth ,
334
343
} ,
335
344
frame : { show : false } ,
336
345
label : { show : false } ,
337
- layout : { margin : 0 } ,
346
+ layout : { margin : 0 , thresholdWidth : 0 } ,
338
347
cell : { border : { width : 0 } } ,
339
348
threshold : {
340
349
values : thresholds ,
@@ -343,12 +352,13 @@ class SingleStatCtrl extends MetricsPanelCtrl {
343
352
margin : 8 ,
344
353
font : { size : 18 }
345
354
} ,
346
- width : 8
355
+ show : panel . gauge . thresholdMarkers ,
356
+ width : thresholdMarkersWidth ,
347
357
} ,
348
358
value : {
349
359
color : panel . colorValue ? getColorForValue ( data , data . valueRounded ) : null ,
350
360
formatter : function ( ) { return getValueText ( ) ; } ,
351
- font : { size : getGaugeFontSize ( ) , family : 'Helvetica Neue", Helvetica, Arial, sans-serif' }
361
+ font : { size : fontSize , family : 'Helvetica Neue", Helvetica, Arial, sans-serif' }
352
362
} ,
353
363
show : true
354
364
}
0 commit comments