Commit 069d718b by Gaurav M Shah Committed by Torkel Ödegaard

Graph: Added series override option to have hidden series be persisted (#20124)

parent ca75a29d
...@@ -137,6 +137,7 @@ Display styles control visual properties of the graph. ...@@ -137,6 +137,7 @@ Display styles control visual properties of the graph.
- **Line Width** - The width of the line for a series (default 1). - **Line Width** - The width of the line for a series (default 1).
- **Staircase** - Draws adjacent points as staircase - **Staircase** - Draws adjacent points as staircase
- **Points Radius** - Adjust the size of points when *Points* are selected as *Draw Mode*. - **Points Radius** - Adjust the size of points when *Points* are selected as *Draw Mode*.
- **Hidden Series** - Hide series by default in graph.
#### Hover tooltip #### Hover tooltip
......
...@@ -94,6 +94,7 @@ export default class TimeSeries { ...@@ -94,6 +94,7 @@ export default class TimeSeries {
isOutsideRange: boolean; isOutsideRange: boolean;
lines: any; lines: any;
hiddenSeries: boolean;
dashes: any; dashes: any;
bars: any; bars: any;
points: any; points: any;
...@@ -200,6 +201,9 @@ export default class TimeSeries { ...@@ -200,6 +201,9 @@ export default class TimeSeries {
if (override.yaxis !== void 0) { if (override.yaxis !== void 0) {
this.yaxis = override.yaxis; this.yaxis = override.yaxis;
} }
if (override.hiddenSeries !== void 0) {
this.hiddenSeries = override.hiddenSeries;
}
} }
} }
......
...@@ -27,6 +27,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -27,6 +27,7 @@ class GraphCtrl extends MetricsPanelCtrl {
renderError: boolean; renderError: boolean;
hiddenSeries: any = {}; hiddenSeries: any = {};
hiddenSeriesTainted = false;
seriesList: TimeSeries[] = []; seriesList: TimeSeries[] = [];
dataList: DataFrame[] = []; dataList: DataFrame[] = [];
annotations: any = []; annotations: any = [];
...@@ -84,6 +85,8 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -84,6 +85,8 @@ class GraphCtrl extends MetricsPanelCtrl {
linewidth: 1, linewidth: 1,
// show/hide dashed line // show/hide dashed line
dashes: false, dashes: false,
// show/hide line
hiddenSeries: false,
// length of a dash // length of a dash
dashLength: 10, dashLength: 10,
// length of space between two dashes // length of space between two dashes
...@@ -165,6 +168,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -165,6 +168,7 @@ class GraphCtrl extends MetricsPanelCtrl {
this.addEditorTab('Thresholds & Time Regions', 'public/app/plugins/panel/graph/tab_thresholds_time_regions.html'); this.addEditorTab('Thresholds & Time Regions', 'public/app/plugins/panel/graph/tab_thresholds_time_regions.html');
this.addEditorTab('Data links', 'public/app/plugins/panel/graph/tab_drilldown_links.html'); this.addEditorTab('Data links', 'public/app/plugins/panel/graph/tab_drilldown_links.html');
this.subTabIndex = 0; this.subTabIndex = 0;
this.hiddenSeriesTainted = false;
} }
onInitPanelActions(actions: any[]) { onInitPanelActions(actions: any[]) {
...@@ -267,6 +271,9 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -267,6 +271,9 @@ class GraphCtrl extends MetricsPanelCtrl {
if (series.unit) { if (series.unit) {
this.panel.yaxes[series.yaxis - 1].format = series.unit; this.panel.yaxes[series.yaxis - 1].format = series.unit;
} }
if (this.hiddenSeriesTainted === false && series.hiddenSeries === true) {
this.hiddenSeries[series.alias] = true;
}
} }
} }
...@@ -277,6 +284,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -277,6 +284,7 @@ class GraphCtrl extends MetricsPanelCtrl {
}; };
onToggleSeries = (hiddenSeries: any) => { onToggleSeries = (hiddenSeries: any) => {
this.hiddenSeriesTainted = true;
this.hiddenSeries = hiddenSeries; this.hiddenSeries = hiddenSeries;
this.render(); this.render();
}; };
......
...@@ -106,6 +106,7 @@ export function SeriesOverridesCtrl($scope: any, $element: JQuery, popoverSrv: a ...@@ -106,6 +106,7 @@ export function SeriesOverridesCtrl($scope: any, $element: JQuery, popoverSrv: a
$scope.addOverrideOption('Fill below to', 'fillBelowTo', $scope.getSeriesNames()); $scope.addOverrideOption('Fill below to', 'fillBelowTo', $scope.getSeriesNames());
$scope.addOverrideOption('Staircase line', 'steppedLine', [true, false]); $scope.addOverrideOption('Staircase line', 'steppedLine', [true, false]);
$scope.addOverrideOption('Dashes', 'dashes', [true, false]); $scope.addOverrideOption('Dashes', 'dashes', [true, false]);
$scope.addOverrideOption('Hidden Series', 'hiddenSeries', [true, false]);
$scope.addOverrideOption('Dash Length', 'dashLength', [ $scope.addOverrideOption('Dash Length', 'dashLength', [
1, 1,
2, 2,
......
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