diff --git a/public/app/plugins/panel/graph/legend.ts b/public/app/plugins/panel/graph/legend.ts index 761671c356d..1952f7241e7 100644 --- a/public/app/plugins/panel/graph/legend.ts +++ b/public/app/plugins/panel/graph/legend.ts @@ -238,8 +238,10 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { tbodyElem.append(tableHeaderElem); tbodyElem.append(seriesElements); elem.append(tbodyElem); + tbodyElem.wrap('
'); } else { - elem.append(seriesElements); + elem.append('
'); + elem.find('.graph-legend-content').append(seriesElements); } if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== legendRightDefaultWidth)) { @@ -258,25 +260,16 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { `; - let scrollRoot = elem.parent(); - // let scroller = elem.find(':first-child').first(); - let scroller = elem; + let scrollRoot = elem; + let scroller = elem.find('.graph-legend-content'); // clear existing scroll bar track to prevent duplication - elem - .parent() - .find('.baron__track') - .remove(); + scrollRoot.find('.baron__track').remove(); scrollRoot.addClass(scrollRootClass); $(scrollBarHTML).appendTo(scrollRoot); scroller.addClass(scrollerClass); - // Fix .graph-legend-content max-height - // Couldn't find how to do it via CSS - const legendHeight = scrollRoot.height(); - elem.css('max-height', legendHeight); - let scrollbarParams = { root: scrollRoot[0], scroller: scroller[0], diff --git a/public/app/plugins/panel/graph/template.ts b/public/app/plugins/panel/graph/template.ts index c897327fe1a..0b9eb8227df 100644 --- a/public/app/plugins/panel/graph/template.ts +++ b/public/app/plugins/panel/graph/template.ts @@ -3,9 +3,7 @@ var template = `
-
-
-
+
`; diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 5885b769564..83747d6caaf 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -53,9 +53,11 @@ max-height: 30%; margin: 0; text-align: center; - // padding-top: 6px; + padding-top: 6px; position: relative; + height: 100%; + .popover-content { padding: 0; } @@ -63,7 +65,6 @@ .graph-legend-content { position: relative; - padding-top: 6px; } .graph-legend-icon { @@ -129,9 +130,9 @@ .graph-legend-table { tbody { display: block; + position: relative; overflow-y: auto; overflow-x: hidden; - height: 100%; padding-bottom: 1px; padding-right: 5px; padding-left: 5px;