Commit 4f38d237 by Daniel Lee

legend: small refactoring

parent 49168263
...@@ -15,6 +15,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { ...@@ -15,6 +15,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
var seriesList; var seriesList;
var i; var i;
var legendScrollbar; var legendScrollbar;
const legendRightDefaultWidth = 10;
scope.$on('$destroy', function() { scope.$on('$destroy', function() {
if (legendScrollbar) { if (legendScrollbar) {
...@@ -164,7 +165,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { ...@@ -164,7 +165,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
} }
// render first time for getting proper legend height // render first time for getting proper legend height
if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== 10)) { if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== legendRightDefaultWidth)) {
renderLegendElement(tableHeaderElem); renderLegendElement(tableHeaderElem);
elem.empty(); elem.empty();
} }
...@@ -241,7 +242,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { ...@@ -241,7 +242,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
elem.append(seriesElements); elem.append(seriesElements);
} }
if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== 10)) { if (!panel.legend.rightSide || (panel.legend.rightSide && legendWidth !== legendRightDefaultWidth)) {
addScrollbar(); addScrollbar();
} else { } else {
destroyScrollbar(); destroyScrollbar();
......
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