From 1293fcadd24b4ece234e3f7c4c8b0d13dae1aca9 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Tue, 20 Feb 2018 09:45:30 +0100 Subject: [PATCH] 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 --- public/app/plugins/panel/graph/legend.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/legend.ts b/public/app/plugins/panel/graph/legend.ts index cd43ac58469..0c8852bf55a 100644 --- a/public/app/plugins/panel/graph/legend.ts +++ b/public/app/plugins/panel/graph/legend.ts @@ -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();