Skip to content

Commit f00cbc0

Browse files
committed
fix(panel height): fixed issue with singlestat height, fixes grafana#4679, fixes grafana#4894, fixes grafana#5113
1 parent ee86d24 commit f00cbc0

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

public/app/features/panel/panel_ctrl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import $ from 'jquery';
88
const TITLE_HEIGHT = 25;
99
const EMPTY_TITLE_HEIGHT = 9;
1010
const PANEL_PADDING = 5;
11+
const PANEL_BORDER = 2;
1112

1213
import {Emitter} from 'app/core/core';
1314

@@ -141,7 +142,7 @@ export class PanelCtrl {
141142
}
142143
}
143144

144-
this.height = this.containerHeight - (PANEL_PADDING + (this.panel.title ? TITLE_HEIGHT : EMPTY_TITLE_HEIGHT));
145+
this.height = this.containerHeight - (PANEL_BORDER + PANEL_PADDING + (this.panel.title ? TITLE_HEIGHT : EMPTY_TITLE_HEIGHT));
145146
}
146147

147148
render(payload?) {

public/app/plugins/panel/graph/graph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
6666

6767
function getLegendHeight(panelHeight) {
6868
if (!panel.legend.show || panel.legend.rightSide) {
69-
return 2;
69+
return 0;
7070
}
7171

7272
if (panel.legend.alignAsTable) {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<div class="singlestat-panel">
22

33
</div>
4-
<div class="clearfix"></div>

public/app/plugins/panel/singlestat/module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,13 @@ class SingleStatCtrl extends MetricsPanelCtrl {
234234
var panel = ctrl.panel;
235235
var templateSrv = this.templateSrv;
236236
var data, linkInfo;
237+
var width, height;
237238
var $panelContainer = elem.find('.panel-container');
238239
elem = elem.find('.singlestat-panel');
239240

240241
function setElementHeight() {
242+
width = elem.width();
243+
height = elem.height();
241244
elem.css('height', ctrl.height + 'px');
242245
}
243246

@@ -291,8 +294,6 @@ class SingleStatCtrl extends MetricsPanelCtrl {
291294
}
292295

293296
var plotCanvas = $('<div></div>');
294-
var width = elem.width();
295-
var height = elem.height();
296297
var plotCss = {
297298
top: '10px',
298299
margin: 'auto',

public/sass/components/_panel_singlestat.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
}
66

77
.singlestat-panel-value-container {
8-
padding: 20px;
98
display: table-cell;
109
vertical-align: middle;
1110
text-align: center;

0 commit comments

Comments
 (0)