Commit 10fbfcb1 by Alexander Zobnin Committed by Torkel Ödegaard

Fix graph legend scroll (#10169)

* graph panel: fix legend scroll

* graph panel: enable scroll for table legend

* graph panel: fix legend right side toggle
parent 8aaaee5e
...@@ -220,12 +220,32 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { ...@@ -220,12 +220,32 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
elem.append(tbodyElem); elem.append(tbodyElem);
} else { } else {
elem.append(seriesElements); elem.append(seriesElements);
}
if (!legendScrollbar) { if (!panel.legend.rightSide) {
legendScrollbar = new PerfectScrollbar(elem[0]); addScrollbar();
} else { } else {
legendScrollbar.update(); destroyScrollbar();
} }
}
function addScrollbar() {
const scrollbarOptions = {
// Number of pixels the content height can surpass the container height without enabling the scroll bar.
scrollYMarginOffset: 2,
suppressScrollX: true
};
if (!legendScrollbar) {
legendScrollbar = new PerfectScrollbar(elem[0], scrollbarOptions);
} else {
legendScrollbar.update();
}
}
function destroyScrollbar() {
if (legendScrollbar) {
legendScrollbar.destroy();
} }
} }
} }
......
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