mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Closes #9 , new y format 'ms' formats millisecond values as "200 ms" , "3 s", "4 min" etc.
This commit is contained in:
parent
3d35595397
commit
0c0ca895a8
@ -506,11 +506,14 @@ function($, _, moment) {
|
||||
};
|
||||
|
||||
kbn.msFormat = function(size) {
|
||||
if (size < 500) {
|
||||
if (size < 1000) {
|
||||
return size.toFixed(0) + " ms";
|
||||
}
|
||||
else if (size < 60000) {
|
||||
return (size / 1000).toFixed(1) + " s";
|
||||
}
|
||||
else {
|
||||
return (size / 1000).toFixed(0) + " s";
|
||||
return (size / 60000).toFixed(1) + " min";
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,10 +4,11 @@
|
||||
class="histogram-legend">
|
||||
<i class='icon-minus pointer'
|
||||
ng-style="{color: series.color}"
|
||||
ng-click="toggleSeries(series)">
|
||||
bs-popover="'colorPopup.html'"
|
||||
>
|
||||
</i>
|
||||
<span class='small histogram-legend-item'>
|
||||
<a bs-popover="'colorPopup.html'" data-unique="1" data-placement="{{series.yaxis === 2 ? 'bottomRight' : 'bottomLeft'}}">
|
||||
<a ng-click="toggleSeries(series)" data-unique="1" data-placement="{{series.yaxis === 2 ? 'bottomRight' : 'bottomLeft'}}">
|
||||
{{series.alias}}
|
||||
</a>
|
||||
</span>
|
||||
|
@ -691,6 +691,9 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
return kbn.shortFormat(val,0);
|
||||
};
|
||||
}
|
||||
if (format === 'ms') {
|
||||
axis.tickFormatter = kbn.msFormat;
|
||||
}
|
||||
}
|
||||
|
||||
function time_format(interval) {
|
||||
@ -730,6 +733,9 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
if(item.series.info.y_format === 'short') {
|
||||
value = kbn.shortFormat(value,2);
|
||||
}
|
||||
if(item.series.info.y_format === 'ms') {
|
||||
value = kbn.msFormat(value);
|
||||
}
|
||||
timestamp = scope.panel.timezone === 'browser' ?
|
||||
moment(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss') :
|
||||
moment.utc(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss');
|
||||
|
@ -28,11 +28,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_format" ng-options="f for f in ['none','short','bytes']" ng-change="render()"></select>
|
||||
<select class="input-small" ng-model="panel.y_format" ng-options="f for f in ['none','short','bytes', 'ms']" 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.y2_format" ng-options="f for f in ['none','short','bytes']" ng-change="render()"></select>
|
||||
<select class="input-small" ng-model="panel.y2_format" ng-options="f for f in ['none','short','bytes', 'ms']" ng-change="render()"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
|
Loading…
Reference in New Issue
Block a user