Commit 44b7a261 by Torkel Ödegaard

fix(graph): fix for table legend and scroll, fixes #7204, fixes #6628

parent f4e9bd50
......@@ -9,7 +9,7 @@
"name": "Grafana Project",
"url": "http://grafana.org"
},
"version": "1.0.15",
"version": "1.0.16",
"updated": "2016-09-26"
},
......
......@@ -124,6 +124,7 @@ function (angular, _, $) {
$container.toggleClass('graph-legend-table', panel.legend.alignAsTable === true);
var tableHeaderElem;
if (panel.legend.alignAsTable) {
var header = '<tr>';
header += '<th colspan="2" style="text-align:left"></th>';
......@@ -135,7 +136,7 @@ function (angular, _, $) {
header += getTableHeaderHtml('total');
}
header += '</tr>';
$container.append($(header));
tableHeaderElem = $(header);
}
if (panel.legend.sort) {
......@@ -148,6 +149,8 @@ function (angular, _, $) {
}
var seriesShown = 0;
var seriesElements = [];
for (i = 0; i < seriesList.length; i++) {
var series = seriesList[i];
......@@ -156,6 +159,7 @@ function (angular, _, $) {
}
var html = '<div class="graph-legend-series';
if (series.yaxis === 2) { html += ' graph-legend-series--right-y'; }
if (ctrl.hiddenSeries[series.alias]) { html += ' graph-legend-series-hidden'; }
html += '" data-series-index="' + i + '">';
......@@ -180,7 +184,7 @@ function (angular, _, $) {
}
html += '</div>';
$container.append($(html));
seriesElements.push($(html));
seriesShown++;
}
......@@ -193,9 +197,13 @@ function (angular, _, $) {
}
var topPadding = 6;
$container.css("max-height", maxHeight - topPadding);
var tbodyElem = $('<tbody></tbody>');
tbodyElem.css("height", maxHeight - topPadding);
tbodyElem.append(tableHeaderElem);
tbodyElem.append(seriesElements);
$container.append(tbodyElem);
} else {
$container.css("max-height", "");
$container.append(seriesElements);
}
}
}
......
......@@ -85,9 +85,11 @@
}
.graph-legend-table {
overflow-y: auto;
overflow-x: hidden;
display: table;
tbody {
display: block;
overflow-y: auto;
overflow-x: hidden;
}
.graph-legend-series {
display: table-row;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment