mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix graph legend scroll (#10169)
* graph panel: fix legend scroll * graph panel: enable scroll for table legend * graph panel: fix legend right side toggle
This commit is contained in:
parent
8aaaee5e16
commit
10fbfcb1d3
@ -220,12 +220,32 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
|
||||
elem.append(tbodyElem);
|
||||
} else {
|
||||
elem.append(seriesElements);
|
||||
}
|
||||
|
||||
if (!legendScrollbar) {
|
||||
legendScrollbar = new PerfectScrollbar(elem[0]);
|
||||
} else {
|
||||
legendScrollbar.update();
|
||||
}
|
||||
if (!panel.legend.rightSide) {
|
||||
addScrollbar();
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user