Skip to content

Commit ebb373e

Browse files
committed
fix(graph): fixed issue with toggling series on and off would loose stacking, fixes grafana#4557
1 parent 9f75bda commit ebb373e

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582)
1212
* **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626)
1313
* **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602)
14+
* **Graph Panel**: Fixed issue with hiding series and stacking, fixes [#4557](https://github.com/grafana/grafana/issues/4557)
1415

1516
# 3.0.0-beta2 (2016-04-04)
1617

public/app/plugins/panel/graph/module.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class GraphCtrl extends MetricsPanelCtrl {
116116

117117
this.colors = $scope.$root.colors;
118118

119+
this.events.on('render', this.onRender.bind(this));
119120
this.events.on('data-received', this.onDataReceived.bind(this));
120121
this.events.on('data-error', this.onDataError.bind(this));
121122
this.events.on('data-snapshot-load', this.onDataSnapshotLoad.bind(this));
@@ -215,20 +216,15 @@ class GraphCtrl extends MetricsPanelCtrl {
215216
this.panel.tooltip.msResolution = this.panel.tooltip.msResolution || series.isMsResolutionNeeded();
216217
}
217218

218-
series.applySeriesOverrides(this.panel.seriesOverrides);
219219
return series;
220220
}
221221

222-
seriesOverrideChanged() {
223-
if (!this.seriesList) {
224-
return;
225-
}
222+
onRender() {
223+
if (!this.seriesList) { return; }
226224

227225
for (let series of this.seriesList) {
228226
series.applySeriesOverrides(this.panel.seriesOverrides);
229227
}
230-
231-
this.render();
232228
}
233229

234230
changeSeriesColor(series, color) {
@@ -247,7 +243,6 @@ class GraphCtrl extends MetricsPanelCtrl {
247243
} else {
248244
this.toggleSeriesExclusiveMode(serie);
249245
}
250-
251246
this.render();
252247
}
253248

public/app/plugins/panel/graph/series_overrides_ctrl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ define([
4343
}
4444

4545
$scope.updateCurrentOverrides();
46-
$scope.ctrl.seriesOverrideChanged();
46+
$scope.ctrl.render();
4747
};
4848

4949
$scope.colorSelected = function(color) {
@@ -62,7 +62,7 @@ define([
6262
colorSelected: $scope.colorSelected,
6363
},
6464
onClose: function() {
65-
$scope.ctrl.seriesOverrideChanged();
65+
$scope.ctrl.render();
6666
}
6767
});
6868
};

public/test/specs/seriesOverridesCtrl-specs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ define([
2222
ctx.scope.ctrl = {
2323
refresh: sinon.spy(),
2424
render: sinon.spy(),
25-
seriesOverrideChanged: sinon.spy(),
2625
seriesList: []
2726
};
2827
ctx.scope.render = function() {};

0 commit comments

Comments
 (0)