Browse Source

fixed so legend right works like legend under on small screens

Patrick O'Carroll 7 years ago
parent
commit
f2f709989f

+ 3 - 1
public/app/plugins/panel/graph/legend.ts

@@ -227,6 +227,8 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
       }
 
       function renderLegendElement(tableHeaderElem) {
+        let legendWidth = elem.width();
+
         var seriesElements = renderSeriesLegendElements();
 
         if (panel.legend.alignAsTable) {
@@ -238,7 +240,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
           elem.append(seriesElements);
         }
 
-        if (!panel.legend.rightSide) {
+        if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== 10)) {
           addScrollbar();
         } else {
           destroyScrollbar();

+ 4 - 4
public/sass/components/_panel_graph.scss

@@ -6,11 +6,11 @@
   &--legend-right {
     @include media-breakpoint-up(sm) {
       flex-direction: row;
-    }
 
-    .graph-legend {
-      flex: 0 1 10px;
-      max-height: 100%;
+      .graph-legend {
+        flex: 0 1 10px;
+        max-height: 100%;
+      }
     }
 
     .graph-legend-series {