瀏覽代碼

Graph: small fix to legend sorting, #1030

Torkel Ödegaard 11 年之前
父節點
當前提交
1c0fc3c924
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 5 1
      src/app/panels/graph/legend.js
  2. 1 0
      src/css/less/graph.less

+ 5 - 1
src/app/panels/graph/legend.js

@@ -56,7 +56,11 @@ function (angular, app, _, kbn, $) {
 
 
         function sortLegend(e) {
         function sortLegend(e) {
           var el = $(e.currentTarget);
           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) {
           if (panel.legend.sortDesc === false) {
             panel.legend.sort = null;
             panel.legend.sort = null;
             panel.legend.sortDesc = null;
             panel.legend.sortDesc = null;
@@ -65,7 +69,7 @@ function (angular, app, _, kbn, $) {
           }
           }
 
 
           panel.legend.sortDesc = !panel.legend.sortDesc;
           panel.legend.sortDesc = !panel.legend.sortDesc;
-          panel.legend.sort = el.data('stat');
+          panel.legend.sort = stat;
           render();
           render();
         }
         }
 
 

+ 1 - 0
src/css/less/graph.less

@@ -114,6 +114,7 @@
     font-weight: bold;
     font-weight: bold;
     color: @blue;
     color: @blue;
     font-size: 85%;
     font-size: 85%;
+    white-space: nowrap;
   }
   }
 }
 }