From 1c0fc3c9242e5fa1bb890abf6a1d24e1ec753d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 12 Nov 2014 10:19:33 +0100 Subject: [PATCH] Graph: small fix to legend sorting, #1030 --- src/app/panels/graph/legend.js | 6 +++++- src/css/less/graph.less | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/panels/graph/legend.js b/src/app/panels/graph/legend.js index 65a82760bf2..8c9cd3fad3f 100644 --- a/src/app/panels/graph/legend.js +++ b/src/app/panels/graph/legend.js @@ -56,7 +56,11 @@ function (angular, app, _, kbn, $) { function sortLegend(e) { var el = $(e.currentTarget); + var stat = el.data('stat'); + if (stat !== panel.legend.sort) { panel.legend.sortDesc = null; } + + // if already sort ascending, disable sorting if (panel.legend.sortDesc === false) { panel.legend.sort = null; panel.legend.sortDesc = null; @@ -65,7 +69,7 @@ function (angular, app, _, kbn, $) { } panel.legend.sortDesc = !panel.legend.sortDesc; - panel.legend.sort = el.data('stat'); + panel.legend.sort = stat; render(); } diff --git a/src/css/less/graph.less b/src/css/less/graph.less index ad32e25c4ca..cb489aeb8b3 100644 --- a/src/css/less/graph.less +++ b/src/css/less/graph.less @@ -114,6 +114,7 @@ font-weight: bold; color: @blue; font-size: 85%; + white-space: nowrap; } }