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