Commit 218d4812 by Khushil Dep Committed by Torkel Odegaard

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

parent 78f4a83d
......@@ -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;
});
\ No newline at end of file
......@@ -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) {
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment