diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js index d6b05b578fa..c1236cf50b4 100644 --- a/src/app/components/kbn.js +++ b/src/app/components/kbn.js @@ -574,6 +574,10 @@ function($, _, moment) { return function(val) { return kbn.microsFormat(val, decimals); }; + case 'ns': + return function(val) { + return kbn.nanosFormat(val, decimals); + }; default: return function(val) { return val % 1 === 0 ? val : val.toFixed(decimals); @@ -617,5 +621,23 @@ function($, _, moment) { } }; + kbn.nanosFormat = function(size, decimals) { + if (size < 1000) { + return size.toFixed(0) + " ns"; + } + else if (size < 1000000) { + return (size / 1000).toFixed(decimals) + " µs"; + } + else if (size < 1000000000) { + return (size / 1000000).toFixed(decimals) + " ms"; + } + else if (size < 60000000000){ + return (size / 1000000000).toFixed(decimals) + " s"; + } + else { + return (size / 60000000000).toFixed(decimals) + " m"; + } + }; + return kbn; }); diff --git a/src/app/panels/graphite/axisEditor.html b/src/app/panels/graphite/axisEditor.html index 1a91fe6bcb2..fa17c76b7a9 100644 --- a/src/app/panels/graphite/axisEditor.html +++ b/src/app/panels/graphite/axisEditor.html @@ -10,11 +10,11 @@