mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added UI for time units, minute scalability
This commit is contained in:
parent
c5b39a5100
commit
3c54d14460
@ -489,6 +489,26 @@ function($, _) {
|
||||
}
|
||||
};
|
||||
|
||||
kbn.valueFormats.m = function(size, decimals, scaledDecimals) {
|
||||
if (size === null) { return ""; }
|
||||
|
||||
if (Math.abs(size) < 60) {
|
||||
return kbn.toFixed(size, decimals) + " min";
|
||||
}
|
||||
else if (Math.abs(size) < 1440) {
|
||||
return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 2, " hour");
|
||||
}
|
||||
else if (Math.abs(size) < 10080) {
|
||||
return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, " day");
|
||||
}
|
||||
else if (Math.abs(size) < 604800) {
|
||||
return kbn.toFixedScaled(size / 86400, decimals, scaledDecimals, 4, " week");
|
||||
}
|
||||
else {
|
||||
return kbn.toFixedScaled(size / 5.25948e5, decimals, scaledDecimals, 5, " year");
|
||||
}
|
||||
};
|
||||
|
||||
///// FORMAT MENU /////
|
||||
|
||||
kbn.getUnitFormats = function() {
|
||||
@ -522,6 +542,9 @@ function($, _) {
|
||||
{text: 'microseconds (µs)', value: 'µs' },
|
||||
{text: 'milliseconds (ms)', value: 'ms' },
|
||||
{text: 'seconds (s)', value: 's' },
|
||||
{text: 'minutes (m)', value: 'm' },
|
||||
{text: 'hours (h)', value: 'h' },
|
||||
{text: 'days (d)', value: 'd' },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user