diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js index 5faeafeb1ff..4e64df92b47 100644 --- a/src/app/components/kbn.js +++ b/src/app/components/kbn.js @@ -396,6 +396,53 @@ function($, _, moment) { return (size.toFixed(decimals) + ext); }; + kbn.bpsFormat = function(size, decimals) { + var ext, steps = 0; + + if(_.isUndefined(decimals)) { + decimals = 2; + } else if (decimals === 0) { + decimals = undefined; + } + + while (Math.abs(size) >= 1000) { + steps++; + size /= 1000; + } + + switch (steps) { + case 0: + ext = " bps"; + break; + case 1: + ext = " Kbps"; + break; + case 2: + ext = " Mbps"; + break; + case 3: + ext = " Gbps"; + break; + case 4: + ext = " Tbps"; + break; + case 5: + ext = " Pbps"; + break; + case 6: + ext = " Ebps"; + break; + case 7: + ext = " Zbps"; + break; + case 8: + ext = " Ybps"; + break; + } + + return (size.toFixed(decimals) + ext); + }; + kbn.shortFormat = function(size, decimals) { var ext, steps = 0; @@ -457,6 +504,10 @@ function($, _, moment) { return function(val) { return kbn.bitFormat(val, decimals); }; + case 'bps': + return function(val) { + return kbn.bpsFormat(val, decimals); + }; case 's': return function(val) { return kbn.sFormat(val, decimals); diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index e6f7ca27dee..06b53cd77a5 100755 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -390,6 +390,9 @@ function (angular, $, kbn, moment, _) { case 'bits': url += '&yUnitSystem=binary'; break; + case 'bps': + url += '&yUnitSystem=si'; + break; case 'short': url += '&yUnitSystem=si'; break; diff --git a/src/app/panels/graph/axisEditor.html b/src/app/panels/graph/axisEditor.html index 9edef939e16..6800ee832b9 100644 --- a/src/app/panels/graph/axisEditor.html +++ b/src/app/panels/graph/axisEditor.html @@ -4,7 +4,7 @@
Left Y Axis
- +
@@ -23,7 +23,7 @@
Right Y Axis
- +
diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 2eed6f6172a..2cb69ffae05 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -85,7 +85,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { */ scale : 1, /** @scratch /panels/histogram/3 - * y_formats :: 'none','bytes','bits','short', 's', 'ms' + * y_formats :: 'none','bytes','bits','bps','short', 's', 'ms' */ y_formats : ['short', 'short'], /** @scratch /panels/histogram/5