added an if to check for null to sort null as 0 (#10961)

* added an if to check for null to sort null as 0

* changed 0 to -Infinity
This commit is contained in:
Patrick O'Carroll 2018-02-20 09:45:30 +01:00 committed by Torkel Ödegaard
parent 7d0c3ae6a7
commit 1293fcadd2

View File

@ -151,7 +151,11 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
if (panel.legend.sort) {
seriesList = _.sortBy(seriesList, function(series) {
return series.stats[panel.legend.sort];
let sort = series.stats[panel.legend.sort];
if (sort === null) {
sort = -Infinity;
}
return sort;
});
if (panel.legend.sortDesc) {
seriesList = seriesList.reverse();