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

This commit is contained in:
Khushil Dep 2014-02-25 13:16:43 +00:00 committed by Torkel Odegaard
parent 78f4a83d05
commit 218d481209
3 changed files with 16 additions and 2 deletions

View File

@ -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;
});

View 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) {

View File

@ -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">