Browse Source

fix(graph): fixed issue with toggling series on and off would loose stacking, fixes #4557

Torkel Ödegaard 9 years ago
parent
commit
ebb373eedb

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@
 * **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582)
 * **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626)
 * **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602)
+* **Graph Panel**: Fixed issue with hiding series and stacking, fixes [#4557](https://github.com/grafana/grafana/issues/4557)
 
 # 3.0.0-beta2 (2016-04-04)
 

+ 3 - 8
public/app/plugins/panel/graph/module.ts

@@ -116,6 +116,7 @@ class GraphCtrl extends MetricsPanelCtrl {
 
     this.colors = $scope.$root.colors;
 
+    this.events.on('render', this.onRender.bind(this));
     this.events.on('data-received', this.onDataReceived.bind(this));
     this.events.on('data-error', this.onDataError.bind(this));
     this.events.on('data-snapshot-load', this.onDataSnapshotLoad.bind(this));
@@ -215,20 +216,15 @@ class GraphCtrl extends MetricsPanelCtrl {
       this.panel.tooltip.msResolution = this.panel.tooltip.msResolution || series.isMsResolutionNeeded();
     }
 
-    series.applySeriesOverrides(this.panel.seriesOverrides);
     return series;
   }
 
-  seriesOverrideChanged() {
-    if (!this.seriesList) {
-      return;
-    }
+  onRender() {
+    if (!this.seriesList) { return; }
 
     for (let series of this.seriesList) {
       series.applySeriesOverrides(this.panel.seriesOverrides);
     }
-
-    this.render();
   }
 
   changeSeriesColor(series, color) {
@@ -247,7 +243,6 @@ class GraphCtrl extends MetricsPanelCtrl {
     } else {
       this.toggleSeriesExclusiveMode(serie);
     }
-
     this.render();
   }
 

+ 2 - 2
public/app/plugins/panel/graph/series_overrides_ctrl.js

@@ -43,7 +43,7 @@ define([
       }
 
       $scope.updateCurrentOverrides();
-      $scope.ctrl.seriesOverrideChanged();
+      $scope.ctrl.render();
     };
 
     $scope.colorSelected = function(color) {
@@ -62,7 +62,7 @@ define([
           colorSelected: $scope.colorSelected,
         },
         onClose: function() {
-          $scope.ctrl.seriesOverrideChanged();
+          $scope.ctrl.render();
         }
       });
     };

+ 0 - 1
public/test/specs/seriesOverridesCtrl-specs.js

@@ -22,7 +22,6 @@ define([
       ctx.scope.ctrl = {
         refresh: sinon.spy(),
         render: sinon.spy(),
-        seriesOverrideChanged: sinon.spy(),
         seriesList: []
       };
       ctx.scope.render = function() {};