mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'hide-zero' of https://github.com/utkarshcmu/grafana into utkarshcmu-hide-zero
This commit is contained in:
@@ -28,6 +28,7 @@ class TimeSeries {
|
|||||||
stats: any;
|
stats: any;
|
||||||
legend: boolean;
|
legend: boolean;
|
||||||
allIsNull: boolean;
|
allIsNull: boolean;
|
||||||
|
allIsZero: boolean;
|
||||||
decimals: number;
|
decimals: number;
|
||||||
scaledDecimals: number;
|
scaledDecimals: number;
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ class TimeSeries {
|
|||||||
this.stats.avg = null;
|
this.stats.avg = null;
|
||||||
this.stats.current = null;
|
this.stats.current = null;
|
||||||
this.allIsNull = true;
|
this.allIsNull = true;
|
||||||
|
this.allIsZero = true;
|
||||||
|
|
||||||
var ignoreNulls = fillStyle === 'connected';
|
var ignoreNulls = fillStyle === 'connected';
|
||||||
var nullAsZero = fillStyle === 'null as zero';
|
var nullAsZero = fillStyle === 'null as zero';
|
||||||
@@ -130,6 +132,10 @@ class TimeSeries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentValue != 0) {
|
||||||
|
this.allIsZero = false;
|
||||||
|
}
|
||||||
|
|
||||||
result.push([currentTime, currentValue]);
|
result.push([currentTime, currentValue]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,9 @@
|
|||||||
<li class="tight-form-item last">
|
<li class="tight-form-item last">
|
||||||
<editor-checkbox text="Hide empty" model="panel.legend.hideEmpty" change="render()"></editor-checkbox>
|
<editor-checkbox text="Hide empty" model="panel.legend.hideEmpty" change="render()"></editor-checkbox>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="tight-form-item last">
|
||||||
|
<editor-checkbox text="Hide zero" model="panel.legend.hideZero" change="render()"></editor-checkbox>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ function ($) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!series.data.length || (scope.panel.legend.hideZero && series.allIsZero)) {
|
||||||
|
results.push({ hidden: true });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
hoverIndex = this.findHoverIndexFromData(pos.x, series);
|
hoverIndex = this.findHoverIndexFromData(pos.x, series);
|
||||||
results.time = series.data[hoverIndex][0];
|
results.time = series.data[hoverIndex][0];
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ function (angular, _, $) {
|
|||||||
if (!series.legend) {
|
if (!series.legend) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// ignore zero series
|
||||||
|
if (panel.legend.hideZero && series.allIsZero) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var html = '<div class="graph-legend-series';
|
var html = '<div class="graph-legend-series';
|
||||||
if (series.yaxis === 2) { html += ' pull-right'; }
|
if (series.yaxis === 2) { html += ' pull-right'; }
|
||||||
|
|||||||
Reference in New Issue
Block a user