From 244e682c2ba1cbdccc6cb1ee15c5785adbed5e8e Mon Sep 17 00:00:00 2001 From: Johannes Wienke Date: Fri, 10 Jul 2015 12:16:41 +0200 Subject: [PATCH] Series override option to hide legend entries Adds a series override option to hide certain series from the legend. * public/app/components/timeSeries.js: boolean flag to decide display in legend and application of override option for this flag * public/app/panels/graph/legend.js: exclude hidden series * public/app/panels/graph/seriesOverridesCtrl.js: add legend override option This fixes #2324 --- public/app/components/timeSeries.js | 2 ++ public/app/panels/graph/legend.js | 4 ++++ public/app/panels/graph/seriesOverridesCtrl.js | 1 + 3 files changed, 7 insertions(+) diff --git a/public/app/components/timeSeries.js b/public/app/components/timeSeries.js index 3c41378947e..74194e68ff9 100644 --- a/public/app/components/timeSeries.js +++ b/public/app/components/timeSeries.js @@ -13,6 +13,7 @@ function (_, kbn) { this.color = opts.color; this.valueFormater = kbn.valueFormats.none; this.stats = {}; + this.legend = true; } function matchSeriesOverride(aliasOrRegex, seriesAlias) { @@ -55,6 +56,7 @@ function (_, kbn) { if (override.fillBelowTo !== void 0) { this.fillBelowTo = override.fillBelowTo; } if (override.color !== void 0) { this.color = override.color; } if (override.transform !== void 0) { this.transform = override.transform; } + if (override.legend !== void 0) { this.legend = override.legend; } if (override.yaxis !== void 0) { this.yaxis = override.yaxis; diff --git a/public/app/panels/graph/legend.js b/public/app/panels/graph/legend.js index 1f016f2c3a3..beea27ec8b7 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/panels/graph/legend.js @@ -130,6 +130,10 @@ function (angular, app, _, kbn, $) { if (panel.legend.hideEmpty && series.allIsNull) { continue; } + // ignore series excluded via override + if (!series.legend) { + continue; + } var html = '