Explorar o código

Add the ability to set microseconds to the Y-Axis on graphs.

Khushil Dep %!s(int64=12) %!d(string=hai) anos
pai
achega
218d481209

+ 11 - 0
src/app/components/kbn.js

@@ -517,5 +517,16 @@ function($, _, moment) {
     }
   };
 
+  kbn.microsFormat = function(size) {
+    if (size < 1000) {
+      return size.toFixed(0) + " µs";
+    }
+    else if (size < 1000000) {
+      return (size / 1000).toFixed(1) + " ms";
+    }
+    else {
+      return (size / 1000000).toFixed(1) + " s";
+  };
+
   return kbn;
 });

+ 3 - 0
src/app/directives/grafanaGraph.js

@@ -300,6 +300,9 @@ function (angular, $, kbn, moment, _) {
           if (format === 'ms') {
             axis.tickFormatter = kbn.msFormat;
           }
+          if (format === 'µs') {
+            axis.tickFormatter = kbm.microsFormat;
+          }
         }
 
         function time_format(interval, ticks, min, max) {

+ 2 - 2
src/app/panels/graphite/axisEditor.html

@@ -10,11 +10,11 @@
     </div>
     <div class="editor-option">
       <label class="small">Left Y Format <tip>Y-axis formatting</tip></label>
-      <select class="input-small" ng-model="panel.y_formats[0]" ng-options="f for f in ['none','short','bytes', 'ms']" ng-change="render()"></select>
+      <select class="input-small" ng-model="panel.y_formats[0]" ng-options="f for f in ['none','short','bytes', 'ms', 'µs']" ng-change="render()"></select>
     </div>
     <div class="editor-option">
       <label class="small">Right Y Format <tip>Y-axis formatting</tip></label>
-      <select class="input-small" ng-model="panel.y_formats[1]" ng-options="f for f in ['none','short','bytes', 'ms']" ng-change="render()"></select>
+      <select class="input-small" ng-model="panel.y_formats[1]" ng-options="f for f in ['none','short','bytes', 'ms', 'µs']" ng-change="render()"></select>
     </div>
 
     <div class="editor-option">