Skip to content

Commit 846cf93

Browse files
committed
Graph: New legend option hideEmtpy to hide series with only null values from legend, Closes grafana#1028
1 parent 162eb4c commit 846cf93

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 1.9.1 (unreleased)
22

3+
**Enhancements**
4+
- [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values
5+
36
**Fixes**
47
- [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled
58
- [Issue #1207](https://github.com/grafana/grafana/issues/1207). Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter

src/app/panels/graph/axisEditor.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ <h5>Legend styles</h5>
4444
<editor-opt-bool text="Values" model="panel.legend.values" change="render()"></editor-opt-bool>
4545
<editor-opt-bool text="Table" model="panel.legend.alignAsTable" change="render()"></editor-opt-bool>
4646
<editor-opt-bool text="Right side" model="panel.legend.rightSide" change="render()"></editor-opt-bool>
47+
<editor-opt-bool text="Hide empty" model="panel.legend.hideEmpty" tip="Hides series with only null values" change="render()"></editor-opt-bool>
4748
</div>
4849

4950
<div class="section" ng-if="panel.legend.values">

src/app/panels/graph/legend.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ function (angular, app, _, kbn, $) {
125125

126126
for (i = 0; i < seriesList.length; i++) {
127127
var series = seriesList[i];
128+
129+
// ignore empty series
130+
if (panel.legend.hideEmpty && series.allIsNull) {
131+
continue;
132+
}
133+
128134
var html = '<div class="graph-legend-series';
129135
if (series.yaxis === 2) { html += ' pull-right'; }
130136
if (scope.hiddenSeries[series.alias]) { html += ' graph-legend-series-hidden'; }

0 commit comments

Comments
 (0)