Browse Source

Merge pull request #76 from axe-felix/patch-1

added support for 'less is worse' thresholds
Torkel Ödegaard 12 years ago
parent
commit
bf9c0bb914
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/app/directives/grafanaGraph.js

+ 7 - 2
src/app/directives/grafanaGraph.js

@@ -141,7 +141,12 @@ function (angular, $, kbn, moment, _) {
             });
 
             if (panel.grid.threshold2) {
-              var limit2 = panel.grid.thresholdLine ? panel.grid.threshold2 : null;
+              var limit2;
+              if (panel.grid.thresholdLine) {
+                limit2 = panel.grid.threshold2;
+              } else {
+                limit2 = panel.grid.threshold1 > panel.grid.threshold2 ?  -Infinity : +Infinity;
+              }
               options.grid.markings.push({
                 yaxis: { from: panel.grid.threshold2, to: limit2 },
                 color: panel.grid.threshold2Color
@@ -340,4 +345,4 @@ function (angular, $, kbn, moment, _) {
     };
   });
 
-});
+});