|
|
@@ -1,12 +1,12 @@
|
|
|
-import _ from 'lodash';
|
|
|
-import moment from 'moment';
|
|
|
+import _ from "lodash";
|
|
|
+import moment from "moment";
|
|
|
|
|
|
var kbn: any = {};
|
|
|
|
|
|
kbn.valueFormats = {};
|
|
|
|
|
|
kbn.regexEscape = function(value) {
|
|
|
- return value.replace(/[\\^$*+?.()|[\]{}\/]/g, '\\$&');
|
|
|
+ return value.replace(/[\\^$*+?.()|[\]{}\/]/g, "\\$&");
|
|
|
};
|
|
|
|
|
|
///// HELPER FUNCTIONS /////
|
|
|
@@ -105,41 +105,41 @@ kbn.round_interval = function(interval) {
|
|
|
kbn.secondsToHms = function(seconds) {
|
|
|
var numyears = Math.floor(seconds / 31536000);
|
|
|
if (numyears) {
|
|
|
- return numyears + 'y';
|
|
|
+ return numyears + "y";
|
|
|
}
|
|
|
var numdays = Math.floor((seconds % 31536000) / 86400);
|
|
|
if (numdays) {
|
|
|
- return numdays + 'd';
|
|
|
+ return numdays + "d";
|
|
|
}
|
|
|
var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);
|
|
|
if (numhours) {
|
|
|
- return numhours + 'h';
|
|
|
+ return numhours + "h";
|
|
|
}
|
|
|
var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60);
|
|
|
if (numminutes) {
|
|
|
- return numminutes + 'm';
|
|
|
+ return numminutes + "m";
|
|
|
}
|
|
|
var numseconds = Math.floor((((seconds % 31536000) % 86400) % 3600) % 60);
|
|
|
if (numseconds) {
|
|
|
- return numseconds + 's';
|
|
|
+ return numseconds + "s";
|
|
|
}
|
|
|
var nummilliseconds = Math.floor(seconds * 1000.0);
|
|
|
if (nummilliseconds) {
|
|
|
- return nummilliseconds + 'ms';
|
|
|
+ return nummilliseconds + "ms";
|
|
|
}
|
|
|
|
|
|
- return 'less than a millisecond'; //'just now' //or other string you like;
|
|
|
+ return "less than a millisecond"; //'just now' //or other string you like;
|
|
|
};
|
|
|
|
|
|
kbn.to_percent = function(nr, outof) {
|
|
|
- return Math.floor(nr / outof * 10000) / 100 + '%';
|
|
|
+ return Math.floor(nr / outof * 10000) / 100 + "%";
|
|
|
};
|
|
|
|
|
|
kbn.addslashes = function(str) {
|
|
|
- str = str.replace(/\\/g, '\\\\');
|
|
|
+ str = str.replace(/\\/g, "\\\\");
|
|
|
str = str.replace(/\'/g, "\\'");
|
|
|
str = str.replace(/\"/g, '\\"');
|
|
|
- str = str.replace(/\0/g, '\\0');
|
|
|
+ str = str.replace(/\0/g, "\\0");
|
|
|
return str;
|
|
|
};
|
|
|
|
|
|
@@ -154,7 +154,7 @@ kbn.intervals_in_seconds = {
|
|
|
h: 3600,
|
|
|
m: 60,
|
|
|
s: 1,
|
|
|
- ms: 0.001,
|
|
|
+ ms: 0.001
|
|
|
};
|
|
|
|
|
|
kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
|
|
|
@@ -162,32 +162,36 @@ kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
|
|
|
var intervalMs;
|
|
|
|
|
|
if (lowLimitInterval) {
|
|
|
- if (lowLimitInterval[0] === '>') {
|
|
|
+ if (lowLimitInterval[0] === ">") {
|
|
|
lowLimitInterval = lowLimitInterval.slice(1);
|
|
|
}
|
|
|
lowLimitMs = kbn.interval_to_ms(lowLimitInterval);
|
|
|
}
|
|
|
|
|
|
- intervalMs = kbn.round_interval((range.to.valueOf() - range.from.valueOf()) / resolution);
|
|
|
+ intervalMs = kbn.round_interval(
|
|
|
+ (range.to.valueOf() - range.from.valueOf()) / resolution
|
|
|
+ );
|
|
|
if (lowLimitMs > intervalMs) {
|
|
|
intervalMs = lowLimitMs;
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
intervalMs: intervalMs,
|
|
|
- interval: kbn.secondsToHms(intervalMs / 1000),
|
|
|
+ interval: kbn.secondsToHms(intervalMs / 1000)
|
|
|
};
|
|
|
};
|
|
|
|
|
|
kbn.describe_interval = function(str) {
|
|
|
var matches = str.match(kbn.interval_regex);
|
|
|
if (!matches || !_.has(kbn.intervals_in_seconds, matches[2])) {
|
|
|
- throw new Error('Invalid interval string, expecting a number followed by one of "Mwdhmsy"');
|
|
|
+ throw new Error(
|
|
|
+ 'Invalid interval string, expecting a number followed by one of "Mwdhmsy"'
|
|
|
+ );
|
|
|
} else {
|
|
|
return {
|
|
|
sec: kbn.intervals_in_seconds[matches[2]],
|
|
|
type: matches[2],
|
|
|
- count: parseInt(matches[1], 10),
|
|
|
+ count: parseInt(matches[1], 10)
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
@@ -205,7 +209,11 @@ kbn.interval_to_seconds = function(str) {
|
|
|
kbn.query_color_dot = function(color, diameter) {
|
|
|
return (
|
|
|
'<div class="icon-circle" style="' +
|
|
|
- ['display:inline-block', 'color:' + color, 'font-size:' + diameter + 'px'].join(';') +
|
|
|
+ [
|
|
|
+ "display:inline-block",
|
|
|
+ "color:" + color,
|
|
|
+ "font-size:" + diameter + "px"
|
|
|
+ ].join(";") +
|
|
|
'"></div>'
|
|
|
);
|
|
|
};
|
|
|
@@ -213,46 +221,55 @@ kbn.query_color_dot = function(color, diameter) {
|
|
|
kbn.slugifyForUrl = function(str) {
|
|
|
return str
|
|
|
.toLowerCase()
|
|
|
- .replace(/[^\w ]+/g, '')
|
|
|
- .replace(/ +/g, '-');
|
|
|
+ .replace(/[^\w ]+/g, "")
|
|
|
+ .replace(/ +/g, "-");
|
|
|
};
|
|
|
|
|
|
kbn.stringToJsRegex = function(str) {
|
|
|
- if (str[0] !== '/') {
|
|
|
- return new RegExp('^' + str + '$');
|
|
|
+ if (str[0] !== "/") {
|
|
|
+ return new RegExp("^" + str + "$");
|
|
|
}
|
|
|
|
|
|
- var match = str.match(new RegExp('^/(.*?)/(g?i?m?y?)$'));
|
|
|
+ var match = str.match(new RegExp("^/(.*?)/(g?i?m?y?)$"));
|
|
|
return new RegExp(match[1], match[2]);
|
|
|
};
|
|
|
|
|
|
kbn.toFixed = function(value, decimals) {
|
|
|
if (value === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
var factor = decimals ? Math.pow(10, Math.max(0, decimals)) : 1;
|
|
|
var formatted = String(Math.round(value * factor) / factor);
|
|
|
|
|
|
// if exponent return directly
|
|
|
- if (formatted.indexOf('e') !== -1 || value === 0) {
|
|
|
+ if (formatted.indexOf("e") !== -1 || value === 0) {
|
|
|
return formatted;
|
|
|
}
|
|
|
|
|
|
// If tickDecimals was specified, ensure that we have exactly that
|
|
|
// much precision; otherwise default to the value's own precision.
|
|
|
if (decimals != null) {
|
|
|
- var decimalPos = formatted.indexOf('.');
|
|
|
+ var decimalPos = formatted.indexOf(".");
|
|
|
var precision = decimalPos === -1 ? 0 : formatted.length - decimalPos - 1;
|
|
|
if (precision < decimals) {
|
|
|
- return (precision ? formatted : formatted + '.') + String(factor).substr(1, decimals - precision);
|
|
|
+ return (
|
|
|
+ (precision ? formatted : formatted + ".") +
|
|
|
+ String(factor).substr(1, decimals - precision)
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return formatted;
|
|
|
};
|
|
|
|
|
|
-kbn.toFixedScaled = function(value, decimals, scaledDecimals, additionalDecimals, ext) {
|
|
|
+kbn.toFixedScaled = function(
|
|
|
+ value,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ additionalDecimals,
|
|
|
+ ext
|
|
|
+) {
|
|
|
if (scaledDecimals === null) {
|
|
|
return kbn.toFixed(value, decimals) + ext;
|
|
|
} else {
|
|
|
@@ -278,9 +295,9 @@ kbn.formatBuilders = {};
|
|
|
kbn.formatBuilders.fixedUnit = function(unit) {
|
|
|
return function(size, decimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
- return kbn.toFixed(size, decimals) + ' ' + unit;
|
|
|
+ return kbn.toFixed(size, decimals) + " " + unit;
|
|
|
};
|
|
|
};
|
|
|
|
|
|
@@ -290,7 +307,7 @@ kbn.formatBuilders.fixedUnit = function(unit) {
|
|
|
kbn.formatBuilders.scaledUnits = function(factor, extArray) {
|
|
|
return function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
var steps = 0;
|
|
|
@@ -301,7 +318,7 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
|
|
|
size /= factor;
|
|
|
|
|
|
if (steps >= limit) {
|
|
|
- return 'NA';
|
|
|
+ return "NA";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -317,10 +334,10 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
|
|
|
// offset is given, it adjusts the starting units at the given prefix; a value
|
|
|
// of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc.
|
|
|
kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
|
|
|
- var prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
|
|
+ var prefixes = ["n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
|
prefixes = prefixes.slice(3 + (offset || 0));
|
|
|
var units = prefixes.map(function(p) {
|
|
|
- return ' ' + p + unit;
|
|
|
+ return " " + p + unit;
|
|
|
});
|
|
|
return kbn.formatBuilders.scaledUnits(1000, units);
|
|
|
};
|
|
|
@@ -329,9 +346,11 @@ kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
|
|
|
// offset is given, it starts the units at the given prefix; otherwise, the
|
|
|
// offset defaults to zero and the initial unit is not prefixed.
|
|
|
kbn.formatBuilders.binarySIPrefix = function(unit, offset) {
|
|
|
- var prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset);
|
|
|
+ var prefixes = ["", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi"].slice(
|
|
|
+ offset
|
|
|
+ );
|
|
|
var units = prefixes.map(function(p) {
|
|
|
- return ' ' + p + unit;
|
|
|
+ return " " + p + unit;
|
|
|
});
|
|
|
return kbn.formatBuilders.scaledUnits(1024, units);
|
|
|
};
|
|
|
@@ -339,11 +358,11 @@ kbn.formatBuilders.binarySIPrefix = function(unit, offset) {
|
|
|
// Currency formatter for prefixing a symbol onto a number. Supports scaling
|
|
|
// up to the trillions.
|
|
|
kbn.formatBuilders.currency = function(symbol) {
|
|
|
- var units = ['', 'K', 'M', 'B', 'T'];
|
|
|
+ var units = ["", "K", "M", "B", "T"];
|
|
|
var scaler = kbn.formatBuilders.scaledUnits(1000, units);
|
|
|
return function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
var scaled = scaler(size, decimals, scaledDecimals);
|
|
|
return symbol + scaled;
|
|
|
@@ -351,14 +370,14 @@ kbn.formatBuilders.currency = function(symbol) {
|
|
|
};
|
|
|
|
|
|
kbn.formatBuilders.simpleCountUnit = function(symbol) {
|
|
|
- var units = ['', 'K', 'M', 'B', 'T'];
|
|
|
+ var units = ["", "K", "M", "B", "T"];
|
|
|
var scaler = kbn.formatBuilders.scaledUnits(1000, units);
|
|
|
return function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
var scaled = scaler(size, decimals, scaledDecimals);
|
|
|
- return scaled + ' ' + symbol;
|
|
|
+ return scaled + " " + symbol;
|
|
|
};
|
|
|
};
|
|
|
|
|
|
@@ -367,31 +386,31 @@ kbn.formatBuilders.simpleCountUnit = function(symbol) {
|
|
|
// Dimensionless Units
|
|
|
kbn.valueFormats.none = kbn.toFixed;
|
|
|
kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, [
|
|
|
- '',
|
|
|
- ' K',
|
|
|
- ' Mil',
|
|
|
- ' Bil',
|
|
|
- ' Tri',
|
|
|
- ' Quadr',
|
|
|
- ' Quint',
|
|
|
- ' Sext',
|
|
|
- ' Sept',
|
|
|
+ "",
|
|
|
+ " K",
|
|
|
+ " Mil",
|
|
|
+ " Bil",
|
|
|
+ " Tri",
|
|
|
+ " Quadr",
|
|
|
+ " Quint",
|
|
|
+ " Sext",
|
|
|
+ " Sept"
|
|
|
]);
|
|
|
-kbn.valueFormats.dB = kbn.formatBuilders.fixedUnit('dB');
|
|
|
-kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm');
|
|
|
+kbn.valueFormats.dB = kbn.formatBuilders.fixedUnit("dB");
|
|
|
+kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit("ppm");
|
|
|
|
|
|
kbn.valueFormats.percent = function(size, decimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
- return kbn.toFixed(size, decimals) + '%';
|
|
|
+ return kbn.toFixed(size, decimals) + "%";
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.percentunit = function(size, decimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
- return kbn.toFixed(100 * size, decimals) + '%';
|
|
|
+ return kbn.toFixed(100 * size, decimals) + "%";
|
|
|
};
|
|
|
|
|
|
/* Formats the value to hex. Uses float if specified decimals are not 0.
|
|
|
@@ -399,7 +418,7 @@ kbn.valueFormats.percentunit = function(size, decimals) {
|
|
|
|
|
|
kbn.valueFormats.hex = function(value, decimals) {
|
|
|
if (value == null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
return parseFloat(kbn.toFixed(value, decimals))
|
|
|
.toString(16)
|
|
|
@@ -408,13 +427,13 @@ kbn.valueFormats.hex = function(value, decimals) {
|
|
|
|
|
|
kbn.valueFormats.hex0x = function(value, decimals) {
|
|
|
if (value == null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
var hexString = kbn.valueFormats.hex(value, decimals);
|
|
|
- if (hexString.substring(0, 1) === '-') {
|
|
|
- return '-0x' + hexString.substring(1);
|
|
|
+ if (hexString.substring(0, 1) === "-") {
|
|
|
+ return "-0x" + hexString.substring(1);
|
|
|
}
|
|
|
- return '0x' + hexString;
|
|
|
+ return "0x" + hexString;
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.sci = function(value, decimals) {
|
|
|
@@ -426,305 +445,387 @@ kbn.valueFormats.locale = function(value, decimals) {
|
|
|
};
|
|
|
|
|
|
// Currencies
|
|
|
-kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$');
|
|
|
-kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£');
|
|
|
-kbn.valueFormats.currencyEUR = kbn.formatBuilders.currency('€');
|
|
|
-kbn.valueFormats.currencyJPY = kbn.formatBuilders.currency('¥');
|
|
|
-kbn.valueFormats.currencyRUB = kbn.formatBuilders.currency('₽');
|
|
|
-kbn.valueFormats.currencyUAH = kbn.formatBuilders.currency('₴');
|
|
|
-kbn.valueFormats.currencyBRL = kbn.formatBuilders.currency('R$');
|
|
|
-kbn.valueFormats.currencyDKK = kbn.formatBuilders.currency('kr');
|
|
|
-kbn.valueFormats.currencyISK = kbn.formatBuilders.currency('kr');
|
|
|
-kbn.valueFormats.currencyNOK = kbn.formatBuilders.currency('kr');
|
|
|
-kbn.valueFormats.currencySEK = kbn.formatBuilders.currency('kr');
|
|
|
+kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency("$");
|
|
|
+kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency("£");
|
|
|
+kbn.valueFormats.currencyEUR = kbn.formatBuilders.currency("€");
|
|
|
+kbn.valueFormats.currencyJPY = kbn.formatBuilders.currency("¥");
|
|
|
+kbn.valueFormats.currencyRUB = kbn.formatBuilders.currency("₽");
|
|
|
+kbn.valueFormats.currencyUAH = kbn.formatBuilders.currency("₴");
|
|
|
+kbn.valueFormats.currencyBRL = kbn.formatBuilders.currency("R$");
|
|
|
+kbn.valueFormats.currencyDKK = kbn.formatBuilders.currency("kr");
|
|
|
+kbn.valueFormats.currencyISK = kbn.formatBuilders.currency("kr");
|
|
|
+kbn.valueFormats.currencyNOK = kbn.formatBuilders.currency("kr");
|
|
|
+kbn.valueFormats.currencySEK = kbn.formatBuilders.currency("kr");
|
|
|
|
|
|
// Data (Binary)
|
|
|
-kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b');
|
|
|
-kbn.valueFormats.bytes = kbn.formatBuilders.binarySIPrefix('B');
|
|
|
-kbn.valueFormats.kbytes = kbn.formatBuilders.binarySIPrefix('B', 1);
|
|
|
-kbn.valueFormats.mbytes = kbn.formatBuilders.binarySIPrefix('B', 2);
|
|
|
-kbn.valueFormats.gbytes = kbn.formatBuilders.binarySIPrefix('B', 3);
|
|
|
+kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix("b");
|
|
|
+kbn.valueFormats.bytes = kbn.formatBuilders.binarySIPrefix("B");
|
|
|
+kbn.valueFormats.kbytes = kbn.formatBuilders.binarySIPrefix("B", 1);
|
|
|
+kbn.valueFormats.mbytes = kbn.formatBuilders.binarySIPrefix("B", 2);
|
|
|
+kbn.valueFormats.gbytes = kbn.formatBuilders.binarySIPrefix("B", 3);
|
|
|
|
|
|
// Data (Decimal)
|
|
|
-kbn.valueFormats.decbits = kbn.formatBuilders.decimalSIPrefix('b');
|
|
|
-kbn.valueFormats.decbytes = kbn.formatBuilders.decimalSIPrefix('B');
|
|
|
-kbn.valueFormats.deckbytes = kbn.formatBuilders.decimalSIPrefix('B', 1);
|
|
|
-kbn.valueFormats.decmbytes = kbn.formatBuilders.decimalSIPrefix('B', 2);
|
|
|
-kbn.valueFormats.decgbytes = kbn.formatBuilders.decimalSIPrefix('B', 3);
|
|
|
+kbn.valueFormats.decbits = kbn.formatBuilders.decimalSIPrefix("b");
|
|
|
+kbn.valueFormats.decbytes = kbn.formatBuilders.decimalSIPrefix("B");
|
|
|
+kbn.valueFormats.deckbytes = kbn.formatBuilders.decimalSIPrefix("B", 1);
|
|
|
+kbn.valueFormats.decmbytes = kbn.formatBuilders.decimalSIPrefix("B", 2);
|
|
|
+kbn.valueFormats.decgbytes = kbn.formatBuilders.decimalSIPrefix("B", 3);
|
|
|
|
|
|
// Data Rate
|
|
|
-kbn.valueFormats.pps = kbn.formatBuilders.decimalSIPrefix('pps');
|
|
|
-kbn.valueFormats.bps = kbn.formatBuilders.decimalSIPrefix('bps');
|
|
|
-kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix('Bps');
|
|
|
-kbn.valueFormats.KBs = kbn.formatBuilders.decimalSIPrefix('Bs', 1);
|
|
|
-kbn.valueFormats.Kbits = kbn.formatBuilders.decimalSIPrefix('bps', 1);
|
|
|
-kbn.valueFormats.MBs = kbn.formatBuilders.decimalSIPrefix('Bs', 2);
|
|
|
-kbn.valueFormats.Mbits = kbn.formatBuilders.decimalSIPrefix('bps', 2);
|
|
|
-kbn.valueFormats.GBs = kbn.formatBuilders.decimalSIPrefix('Bs', 3);
|
|
|
-kbn.valueFormats.Gbits = kbn.formatBuilders.decimalSIPrefix('bps', 3);
|
|
|
+kbn.valueFormats.pps = kbn.formatBuilders.decimalSIPrefix("pps");
|
|
|
+kbn.valueFormats.bps = kbn.formatBuilders.decimalSIPrefix("bps");
|
|
|
+kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix("Bps");
|
|
|
+kbn.valueFormats.KBs = kbn.formatBuilders.decimalSIPrefix("Bs", 1);
|
|
|
+kbn.valueFormats.Kbits = kbn.formatBuilders.decimalSIPrefix("bps", 1);
|
|
|
+kbn.valueFormats.MBs = kbn.formatBuilders.decimalSIPrefix("Bs", 2);
|
|
|
+kbn.valueFormats.Mbits = kbn.formatBuilders.decimalSIPrefix("bps", 2);
|
|
|
+kbn.valueFormats.GBs = kbn.formatBuilders.decimalSIPrefix("Bs", 3);
|
|
|
+kbn.valueFormats.Gbits = kbn.formatBuilders.decimalSIPrefix("bps", 3);
|
|
|
|
|
|
// Throughput
|
|
|
-kbn.valueFormats.ops = kbn.formatBuilders.simpleCountUnit('ops');
|
|
|
-kbn.valueFormats.rps = kbn.formatBuilders.simpleCountUnit('rps');
|
|
|
-kbn.valueFormats.wps = kbn.formatBuilders.simpleCountUnit('wps');
|
|
|
-kbn.valueFormats.iops = kbn.formatBuilders.simpleCountUnit('iops');
|
|
|
-kbn.valueFormats.opm = kbn.formatBuilders.simpleCountUnit('opm');
|
|
|
-kbn.valueFormats.rpm = kbn.formatBuilders.simpleCountUnit('rpm');
|
|
|
-kbn.valueFormats.wpm = kbn.formatBuilders.simpleCountUnit('wpm');
|
|
|
+kbn.valueFormats.ops = kbn.formatBuilders.simpleCountUnit("ops");
|
|
|
+kbn.valueFormats.rps = kbn.formatBuilders.simpleCountUnit("rps");
|
|
|
+kbn.valueFormats.wps = kbn.formatBuilders.simpleCountUnit("wps");
|
|
|
+kbn.valueFormats.iops = kbn.formatBuilders.simpleCountUnit("iops");
|
|
|
+kbn.valueFormats.opm = kbn.formatBuilders.simpleCountUnit("opm");
|
|
|
+kbn.valueFormats.rpm = kbn.formatBuilders.simpleCountUnit("rpm");
|
|
|
+kbn.valueFormats.wpm = kbn.formatBuilders.simpleCountUnit("wpm");
|
|
|
|
|
|
// Energy
|
|
|
-kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix('W');
|
|
|
-kbn.valueFormats.kwatt = kbn.formatBuilders.decimalSIPrefix('W', 1);
|
|
|
-kbn.valueFormats.mwatt = kbn.formatBuilders.decimalSIPrefix('W', -1);
|
|
|
-kbn.valueFormats.kwattm = kbn.formatBuilders.decimalSIPrefix('W/Min', 1);
|
|
|
-kbn.valueFormats.voltamp = kbn.formatBuilders.decimalSIPrefix('VA');
|
|
|
-kbn.valueFormats.kvoltamp = kbn.formatBuilders.decimalSIPrefix('VA', 1);
|
|
|
-kbn.valueFormats.voltampreact = kbn.formatBuilders.decimalSIPrefix('var');
|
|
|
-kbn.valueFormats.kvoltampreact = kbn.formatBuilders.decimalSIPrefix('var', 1);
|
|
|
-kbn.valueFormats.watth = kbn.formatBuilders.decimalSIPrefix('Wh');
|
|
|
-kbn.valueFormats.kwatth = kbn.formatBuilders.decimalSIPrefix('Wh', 1);
|
|
|
-kbn.valueFormats.joule = kbn.formatBuilders.decimalSIPrefix('J');
|
|
|
-kbn.valueFormats.ev = kbn.formatBuilders.decimalSIPrefix('eV');
|
|
|
-kbn.valueFormats.amp = kbn.formatBuilders.decimalSIPrefix('A');
|
|
|
-kbn.valueFormats.kamp = kbn.formatBuilders.decimalSIPrefix('A', 1);
|
|
|
-kbn.valueFormats.mamp = kbn.formatBuilders.decimalSIPrefix('A', -1);
|
|
|
-kbn.valueFormats.volt = kbn.formatBuilders.decimalSIPrefix('V');
|
|
|
-kbn.valueFormats.kvolt = kbn.formatBuilders.decimalSIPrefix('V', 1);
|
|
|
-kbn.valueFormats.mvolt = kbn.formatBuilders.decimalSIPrefix('V', -1);
|
|
|
-kbn.valueFormats.dBm = kbn.formatBuilders.decimalSIPrefix('dBm');
|
|
|
-kbn.valueFormats.ohm = kbn.formatBuilders.decimalSIPrefix('Ω');
|
|
|
+kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix("W");
|
|
|
+kbn.valueFormats.kwatt = kbn.formatBuilders.decimalSIPrefix("W", 1);
|
|
|
+kbn.valueFormats.mwatt = kbn.formatBuilders.decimalSIPrefix("W", -1);
|
|
|
+kbn.valueFormats.kwattm = kbn.formatBuilders.decimalSIPrefix("W/Min", 1);
|
|
|
+kbn.valueFormats.voltamp = kbn.formatBuilders.decimalSIPrefix("VA");
|
|
|
+kbn.valueFormats.kvoltamp = kbn.formatBuilders.decimalSIPrefix("VA", 1);
|
|
|
+kbn.valueFormats.voltampreact = kbn.formatBuilders.decimalSIPrefix("var");
|
|
|
+kbn.valueFormats.kvoltampreact = kbn.formatBuilders.decimalSIPrefix("var", 1);
|
|
|
+kbn.valueFormats.watth = kbn.formatBuilders.decimalSIPrefix("Wh");
|
|
|
+kbn.valueFormats.kwatth = kbn.formatBuilders.decimalSIPrefix("Wh", 1);
|
|
|
+kbn.valueFormats.joule = kbn.formatBuilders.decimalSIPrefix("J");
|
|
|
+kbn.valueFormats.ev = kbn.formatBuilders.decimalSIPrefix("eV");
|
|
|
+kbn.valueFormats.amp = kbn.formatBuilders.decimalSIPrefix("A");
|
|
|
+kbn.valueFormats.kamp = kbn.formatBuilders.decimalSIPrefix("A", 1);
|
|
|
+kbn.valueFormats.mamp = kbn.formatBuilders.decimalSIPrefix("A", -1);
|
|
|
+kbn.valueFormats.volt = kbn.formatBuilders.decimalSIPrefix("V");
|
|
|
+kbn.valueFormats.kvolt = kbn.formatBuilders.decimalSIPrefix("V", 1);
|
|
|
+kbn.valueFormats.mvolt = kbn.formatBuilders.decimalSIPrefix("V", -1);
|
|
|
+kbn.valueFormats.dBm = kbn.formatBuilders.decimalSIPrefix("dBm");
|
|
|
+kbn.valueFormats.ohm = kbn.formatBuilders.decimalSIPrefix("Ω");
|
|
|
|
|
|
// Temperature
|
|
|
-kbn.valueFormats.celsius = kbn.formatBuilders.fixedUnit('°C');
|
|
|
-kbn.valueFormats.farenheit = kbn.formatBuilders.fixedUnit('°F');
|
|
|
-kbn.valueFormats.kelvin = kbn.formatBuilders.fixedUnit('K');
|
|
|
-kbn.valueFormats.humidity = kbn.formatBuilders.fixedUnit('%H');
|
|
|
+kbn.valueFormats.celsius = kbn.formatBuilders.fixedUnit("°C");
|
|
|
+kbn.valueFormats.farenheit = kbn.formatBuilders.fixedUnit("°F");
|
|
|
+kbn.valueFormats.kelvin = kbn.formatBuilders.fixedUnit("K");
|
|
|
+kbn.valueFormats.humidity = kbn.formatBuilders.fixedUnit("%H");
|
|
|
|
|
|
// Pressure
|
|
|
-kbn.valueFormats.pressurebar = kbn.formatBuilders.decimalSIPrefix('bar');
|
|
|
-kbn.valueFormats.pressurembar = kbn.formatBuilders.decimalSIPrefix('bar', -1);
|
|
|
-kbn.valueFormats.pressurekbar = kbn.formatBuilders.decimalSIPrefix('bar', 1);
|
|
|
-kbn.valueFormats.pressurehpa = kbn.formatBuilders.fixedUnit('hPa');
|
|
|
+kbn.valueFormats.pressurebar = kbn.formatBuilders.decimalSIPrefix("bar");
|
|
|
+kbn.valueFormats.pressurembar = kbn.formatBuilders.decimalSIPrefix("bar", -1);
|
|
|
+kbn.valueFormats.pressurekbar = kbn.formatBuilders.decimalSIPrefix("bar", 1);
|
|
|
+kbn.valueFormats.pressurehpa = kbn.formatBuilders.fixedUnit("hPa");
|
|
|
kbn.valueFormats.pressurehg = kbn.formatBuilders.fixedUnit('"Hg');
|
|
|
-kbn.valueFormats.pressurepsi = kbn.formatBuilders.scaledUnits(1000, [' psi', ' ksi', ' Mpsi']);
|
|
|
+kbn.valueFormats.pressurepsi = kbn.formatBuilders.scaledUnits(1000, [
|
|
|
+ " psi",
|
|
|
+ " ksi",
|
|
|
+ " Mpsi"
|
|
|
+]);
|
|
|
|
|
|
// Force
|
|
|
-kbn.valueFormats.forceNm = kbn.formatBuilders.decimalSIPrefix('Nm');
|
|
|
-kbn.valueFormats.forcekNm = kbn.formatBuilders.decimalSIPrefix('Nm', 1);
|
|
|
-kbn.valueFormats.forceN = kbn.formatBuilders.decimalSIPrefix('N');
|
|
|
-kbn.valueFormats.forcekN = kbn.formatBuilders.decimalSIPrefix('N', 1);
|
|
|
+kbn.valueFormats.forceNm = kbn.formatBuilders.decimalSIPrefix("Nm");
|
|
|
+kbn.valueFormats.forcekNm = kbn.formatBuilders.decimalSIPrefix("Nm", 1);
|
|
|
+kbn.valueFormats.forceN = kbn.formatBuilders.decimalSIPrefix("N");
|
|
|
+kbn.valueFormats.forcekN = kbn.formatBuilders.decimalSIPrefix("N", 1);
|
|
|
|
|
|
// Length
|
|
|
-kbn.valueFormats.lengthm = kbn.formatBuilders.decimalSIPrefix('m');
|
|
|
-kbn.valueFormats.lengthmm = kbn.formatBuilders.decimalSIPrefix('m', -1);
|
|
|
-kbn.valueFormats.lengthkm = kbn.formatBuilders.decimalSIPrefix('m', 1);
|
|
|
-kbn.valueFormats.lengthmi = kbn.formatBuilders.fixedUnit('mi');
|
|
|
-kbn.valueFormats.lengthft = kbn.formatBuilders.fixedUnit('ft');
|
|
|
+kbn.valueFormats.lengthm = kbn.formatBuilders.decimalSIPrefix("m");
|
|
|
+kbn.valueFormats.lengthmm = kbn.formatBuilders.decimalSIPrefix("m", -1);
|
|
|
+kbn.valueFormats.lengthkm = kbn.formatBuilders.decimalSIPrefix("m", 1);
|
|
|
+kbn.valueFormats.lengthmi = kbn.formatBuilders.fixedUnit("mi");
|
|
|
+kbn.valueFormats.lengthft = kbn.formatBuilders.fixedUnit("ft");
|
|
|
|
|
|
// Area
|
|
|
-kbn.valueFormats.areaM2 = kbn.formatBuilders.fixedUnit('m²');
|
|
|
-kbn.valueFormats.areaF2 = kbn.formatBuilders.fixedUnit('ft²');
|
|
|
-kbn.valueFormats.areaMI2 = kbn.formatBuilders.fixedUnit('mi²');
|
|
|
+kbn.valueFormats.areaM2 = kbn.formatBuilders.fixedUnit("m²");
|
|
|
+kbn.valueFormats.areaF2 = kbn.formatBuilders.fixedUnit("ft²");
|
|
|
+kbn.valueFormats.areaMI2 = kbn.formatBuilders.fixedUnit("mi²");
|
|
|
|
|
|
// Mass
|
|
|
-kbn.valueFormats.massmg = kbn.formatBuilders.decimalSIPrefix('g', -1);
|
|
|
-kbn.valueFormats.massg = kbn.formatBuilders.decimalSIPrefix('g');
|
|
|
-kbn.valueFormats.masskg = kbn.formatBuilders.decimalSIPrefix('g', 1);
|
|
|
-kbn.valueFormats.masst = kbn.formatBuilders.fixedUnit('t');
|
|
|
+kbn.valueFormats.massmg = kbn.formatBuilders.decimalSIPrefix("g", -1);
|
|
|
+kbn.valueFormats.massg = kbn.formatBuilders.decimalSIPrefix("g");
|
|
|
+kbn.valueFormats.masskg = kbn.formatBuilders.decimalSIPrefix("g", 1);
|
|
|
+kbn.valueFormats.masst = kbn.formatBuilders.fixedUnit("t");
|
|
|
|
|
|
// Velocity
|
|
|
-kbn.valueFormats.velocityms = kbn.formatBuilders.fixedUnit('m/s');
|
|
|
-kbn.valueFormats.velocitykmh = kbn.formatBuilders.fixedUnit('km/h');
|
|
|
-kbn.valueFormats.velocitymph = kbn.formatBuilders.fixedUnit('mph');
|
|
|
-kbn.valueFormats.velocityknot = kbn.formatBuilders.fixedUnit('kn');
|
|
|
+kbn.valueFormats.velocityms = kbn.formatBuilders.fixedUnit("m/s");
|
|
|
+kbn.valueFormats.velocitykmh = kbn.formatBuilders.fixedUnit("km/h");
|
|
|
+kbn.valueFormats.velocitymph = kbn.formatBuilders.fixedUnit("mph");
|
|
|
+kbn.valueFormats.velocityknot = kbn.formatBuilders.fixedUnit("kn");
|
|
|
|
|
|
// Acceleration
|
|
|
-kbn.valueFormats.accMS2 = kbn.formatBuilders.fixedUnit('m/sec²');
|
|
|
-kbn.valueFormats.accFS2 = kbn.formatBuilders.fixedUnit('f/sec²');
|
|
|
-kbn.valueFormats.accG = kbn.formatBuilders.fixedUnit('g');
|
|
|
+kbn.valueFormats.accMS2 = kbn.formatBuilders.fixedUnit("m/sec²");
|
|
|
+kbn.valueFormats.accFS2 = kbn.formatBuilders.fixedUnit("f/sec²");
|
|
|
+kbn.valueFormats.accG = kbn.formatBuilders.fixedUnit("g");
|
|
|
|
|
|
// Volume
|
|
|
-kbn.valueFormats.litre = kbn.formatBuilders.decimalSIPrefix('L');
|
|
|
-kbn.valueFormats.mlitre = kbn.formatBuilders.decimalSIPrefix('L', -1);
|
|
|
-kbn.valueFormats.m3 = kbn.formatBuilders.decimalSIPrefix('m3');
|
|
|
-kbn.valueFormats.dm3 = kbn.formatBuilders.decimalSIPrefix('dm3');
|
|
|
-kbn.valueFormats.gallons = kbn.formatBuilders.fixedUnit('gal');
|
|
|
+kbn.valueFormats.litre = kbn.formatBuilders.decimalSIPrefix("L");
|
|
|
+kbn.valueFormats.mlitre = kbn.formatBuilders.decimalSIPrefix("L", -1);
|
|
|
+kbn.valueFormats.m3 = kbn.formatBuilders.decimalSIPrefix("m3");
|
|
|
+kbn.valueFormats.dm3 = kbn.formatBuilders.decimalSIPrefix("dm3");
|
|
|
+kbn.valueFormats.gallons = kbn.formatBuilders.fixedUnit("gal");
|
|
|
|
|
|
// Flow
|
|
|
-kbn.valueFormats.flowgpm = kbn.formatBuilders.fixedUnit('gpm');
|
|
|
-kbn.valueFormats.flowcms = kbn.formatBuilders.fixedUnit('cms');
|
|
|
-kbn.valueFormats.flowcfs = kbn.formatBuilders.fixedUnit('cfs');
|
|
|
-kbn.valueFormats.flowcfm = kbn.formatBuilders.fixedUnit('cfm');
|
|
|
+kbn.valueFormats.flowgpm = kbn.formatBuilders.fixedUnit("gpm");
|
|
|
+kbn.valueFormats.flowcms = kbn.formatBuilders.fixedUnit("cms");
|
|
|
+kbn.valueFormats.flowcfs = kbn.formatBuilders.fixedUnit("cfs");
|
|
|
+kbn.valueFormats.flowcfm = kbn.formatBuilders.fixedUnit("cfm");
|
|
|
|
|
|
// Angle
|
|
|
-kbn.valueFormats.degree = kbn.formatBuilders.fixedUnit('°');
|
|
|
-kbn.valueFormats.radian = kbn.formatBuilders.fixedUnit('rad');
|
|
|
-kbn.valueFormats.grad = kbn.formatBuilders.fixedUnit('grad');
|
|
|
+kbn.valueFormats.degree = kbn.formatBuilders.fixedUnit("°");
|
|
|
+kbn.valueFormats.radian = kbn.formatBuilders.fixedUnit("rad");
|
|
|
+kbn.valueFormats.grad = kbn.formatBuilders.fixedUnit("grad");
|
|
|
|
|
|
// Time
|
|
|
-kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('Hz');
|
|
|
+kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix("Hz");
|
|
|
|
|
|
kbn.valueFormats.ms = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 1000) {
|
|
|
- return kbn.toFixed(size, decimals) + ' ms';
|
|
|
+ return kbn.toFixed(size, decimals) + " ms";
|
|
|
} else if (Math.abs(size) < 60000) {
|
|
|
// Less than 1 min
|
|
|
- return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, ' s');
|
|
|
+ return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, " s");
|
|
|
} else if (Math.abs(size) < 3600000) {
|
|
|
// Less than 1 hour, devide in minutes
|
|
|
- return kbn.toFixedScaled(size / 60000, decimals, scaledDecimals, 5, ' min');
|
|
|
+ return kbn.toFixedScaled(size / 60000, decimals, scaledDecimals, 5, " min");
|
|
|
} else if (Math.abs(size) < 86400000) {
|
|
|
// Less than one day, devide in hours
|
|
|
- return kbn.toFixedScaled(size / 3600000, decimals, scaledDecimals, 7, ' hour');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 3600000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 7,
|
|
|
+ " hour"
|
|
|
+ );
|
|
|
} else if (Math.abs(size) < 31536000000) {
|
|
|
// Less than one year, devide in days
|
|
|
- return kbn.toFixedScaled(size / 86400000, decimals, scaledDecimals, 8, ' day');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 86400000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 8,
|
|
|
+ " day"
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- return kbn.toFixedScaled(size / 31536000000, decimals, scaledDecimals, 10, ' year');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 31536000000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 10,
|
|
|
+ " year"
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.s = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
// Less than 1 µs, devide in ns
|
|
|
if (Math.abs(size) < 0.000001) {
|
|
|
- return kbn.toFixedScaled(size * 1e9, decimals, scaledDecimals - decimals, -9, ' ns');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size * 1e9,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals - decimals,
|
|
|
+ -9,
|
|
|
+ " ns"
|
|
|
+ );
|
|
|
}
|
|
|
// Less than 1 ms, devide in µs
|
|
|
if (Math.abs(size) < 0.001) {
|
|
|
- return kbn.toFixedScaled(size * 1e6, decimals, scaledDecimals - decimals, -6, ' µs');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size * 1e6,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals - decimals,
|
|
|
+ -6,
|
|
|
+ " µs"
|
|
|
+ );
|
|
|
}
|
|
|
// Less than 1 second, devide in ms
|
|
|
if (Math.abs(size) < 1) {
|
|
|
- return kbn.toFixedScaled(size * 1e3, decimals, scaledDecimals - decimals, -3, ' ms');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size * 1e3,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals - decimals,
|
|
|
+ -3,
|
|
|
+ " ms"
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 60) {
|
|
|
- return kbn.toFixed(size, decimals) + ' s';
|
|
|
+ return kbn.toFixed(size, decimals) + " s";
|
|
|
} else if (Math.abs(size) < 3600) {
|
|
|
// Less than 1 hour, devide in minutes
|
|
|
- return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 1, ' min');
|
|
|
+ return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 1, " min");
|
|
|
} else if (Math.abs(size) < 86400) {
|
|
|
// Less than one day, devide in hours
|
|
|
- return kbn.toFixedScaled(size / 3600, decimals, scaledDecimals, 4, ' hour');
|
|
|
+ return kbn.toFixedScaled(size / 3600, decimals, scaledDecimals, 4, " hour");
|
|
|
} else if (Math.abs(size) < 604800) {
|
|
|
// Less than one week, devide in days
|
|
|
- return kbn.toFixedScaled(size / 86400, decimals, scaledDecimals, 5, ' day');
|
|
|
+ return kbn.toFixedScaled(size / 86400, decimals, scaledDecimals, 5, " day");
|
|
|
} else if (Math.abs(size) < 31536000) {
|
|
|
// Less than one year, devide in week
|
|
|
- return kbn.toFixedScaled(size / 604800, decimals, scaledDecimals, 6, ' week');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 604800,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 6,
|
|
|
+ " week"
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- return kbn.toFixedScaled(size / 3.15569e7, decimals, scaledDecimals, 7, ' year');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 3.15569e7,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 7,
|
|
|
+ " year"
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
-kbn.valueFormats['µs'] = function(size, decimals, scaledDecimals) {
|
|
|
+kbn.valueFormats["µs"] = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 1000) {
|
|
|
- return kbn.toFixed(size, decimals) + ' µs';
|
|
|
+ return kbn.toFixed(size, decimals) + " µs";
|
|
|
} else if (Math.abs(size) < 1000000) {
|
|
|
- return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, ' ms');
|
|
|
+ return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, " ms");
|
|
|
} else {
|
|
|
- return kbn.toFixedScaled(size / 1000000, decimals, scaledDecimals, 6, ' s');
|
|
|
+ return kbn.toFixedScaled(size / 1000000, decimals, scaledDecimals, 6, " s");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.ns = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 1000) {
|
|
|
- return kbn.toFixed(size, decimals) + ' ns';
|
|
|
+ return kbn.toFixed(size, decimals) + " ns";
|
|
|
} else if (Math.abs(size) < 1000000) {
|
|
|
- return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, ' µs');
|
|
|
+ return kbn.toFixedScaled(size / 1000, decimals, scaledDecimals, 3, " µs");
|
|
|
} else if (Math.abs(size) < 1000000000) {
|
|
|
- return kbn.toFixedScaled(size / 1000000, decimals, scaledDecimals, 6, ' ms');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 1000000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 6,
|
|
|
+ " ms"
|
|
|
+ );
|
|
|
} else if (Math.abs(size) < 60000000000) {
|
|
|
- return kbn.toFixedScaled(size / 1000000000, decimals, scaledDecimals, 9, ' s');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 1000000000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 9,
|
|
|
+ " s"
|
|
|
+ );
|
|
|
} else {
|
|
|
- return kbn.toFixedScaled(size / 60000000000, decimals, scaledDecimals, 12, ' min');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 60000000000,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 12,
|
|
|
+ " min"
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.m = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 60) {
|
|
|
- return kbn.toFixed(size, decimals) + ' min';
|
|
|
+ return kbn.toFixed(size, decimals) + " min";
|
|
|
} else if (Math.abs(size) < 1440) {
|
|
|
- return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 2, ' hour');
|
|
|
+ return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 2, " hour");
|
|
|
} else if (Math.abs(size) < 10080) {
|
|
|
- return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, ' day');
|
|
|
+ return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, " day");
|
|
|
} else if (Math.abs(size) < 604800) {
|
|
|
- return kbn.toFixedScaled(size / 10080, decimals, scaledDecimals, 4, ' week');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 10080,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 4,
|
|
|
+ " week"
|
|
|
+ );
|
|
|
} else {
|
|
|
- return kbn.toFixedScaled(size / 5.25948e5, decimals, scaledDecimals, 5, ' year');
|
|
|
+ return kbn.toFixedScaled(
|
|
|
+ size / 5.25948e5,
|
|
|
+ decimals,
|
|
|
+ scaledDecimals,
|
|
|
+ 5,
|
|
|
+ " year"
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.h = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 24) {
|
|
|
- return kbn.toFixed(size, decimals) + ' hour';
|
|
|
+ return kbn.toFixed(size, decimals) + " hour";
|
|
|
} else if (Math.abs(size) < 168) {
|
|
|
- return kbn.toFixedScaled(size / 24, decimals, scaledDecimals, 2, ' day');
|
|
|
+ return kbn.toFixedScaled(size / 24, decimals, scaledDecimals, 2, " day");
|
|
|
} else if (Math.abs(size) < 8760) {
|
|
|
- return kbn.toFixedScaled(size / 168, decimals, scaledDecimals, 3, ' week');
|
|
|
+ return kbn.toFixedScaled(size / 168, decimals, scaledDecimals, 3, " week");
|
|
|
} else {
|
|
|
- return kbn.toFixedScaled(size / 8760, decimals, scaledDecimals, 4, ' year');
|
|
|
+ return kbn.toFixedScaled(size / 8760, decimals, scaledDecimals, 4, " year");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.d = function(size, decimals, scaledDecimals) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
if (Math.abs(size) < 7) {
|
|
|
- return kbn.toFixed(size, decimals) + ' day';
|
|
|
+ return kbn.toFixed(size, decimals) + " day";
|
|
|
} else if (Math.abs(size) < 365) {
|
|
|
- return kbn.toFixedScaled(size / 7, decimals, scaledDecimals, 2, ' week');
|
|
|
+ return kbn.toFixedScaled(size / 7, decimals, scaledDecimals, 2, " week");
|
|
|
} else {
|
|
|
- return kbn.toFixedScaled(size / 365, decimals, scaledDecimals, 3, ' year');
|
|
|
+ return kbn.toFixedScaled(size / 365, decimals, scaledDecimals, 3, " year");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
kbn.toDuration = function(size, decimals, timeScale) {
|
|
|
if (size === null) {
|
|
|
- return '';
|
|
|
+ return "";
|
|
|
}
|
|
|
if (size === 0) {
|
|
|
- return '0 ' + timeScale + 's';
|
|
|
+ return "0 " + timeScale + "s";
|
|
|
}
|
|
|
if (size < 0) {
|
|
|
- return kbn.toDuration(-size, decimals, timeScale) + ' ago';
|
|
|
+ return kbn.toDuration(-size, decimals, timeScale) + " ago";
|
|
|
}
|
|
|
|
|
|
var units = [
|
|
|
- { short: 'y', long: 'year' },
|
|
|
- { short: 'M', long: 'month' },
|
|
|
- { short: 'w', long: 'week' },
|
|
|
- { short: 'd', long: 'day' },
|
|
|
- { short: 'h', long: 'hour' },
|
|
|
- { short: 'm', long: 'minute' },
|
|
|
- { short: 's', long: 'second' },
|
|
|
- { short: 'ms', long: 'millisecond' },
|
|
|
+ { short: "y", long: "year" },
|
|
|
+ { short: "M", long: "month" },
|
|
|
+ { short: "w", long: "week" },
|
|
|
+ { short: "d", long: "day" },
|
|
|
+ { short: "h", long: "hour" },
|
|
|
+ { short: "m", long: "minute" },
|
|
|
+ { short: "s", long: "second" },
|
|
|
+ { short: "ms", long: "millisecond" }
|
|
|
];
|
|
|
// convert $size to milliseconds
|
|
|
// intervals_in_seconds uses seconds (duh), convert them to milliseconds here to minimize floating point errors
|
|
|
@@ -744,40 +845,40 @@ kbn.toDuration = function(size, decimals, timeScale) {
|
|
|
if (value >= 1 || decrementDecimals) {
|
|
|
decrementDecimals = true;
|
|
|
var floor = Math.floor(value);
|
|
|
- var unit = units[i].long + (floor !== 1 ? 's' : '');
|
|
|
- strings.push(floor + ' ' + unit);
|
|
|
+ var unit = units[i].long + (floor !== 1 ? "s" : "");
|
|
|
+ strings.push(floor + " " + unit);
|
|
|
size = size % interval;
|
|
|
decimals--;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return strings.join(', ');
|
|
|
+ return strings.join(", ");
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.dtdurationms = function(size, decimals) {
|
|
|
- return kbn.toDuration(size, decimals, 'millisecond');
|
|
|
+ return kbn.toDuration(size, decimals, "millisecond");
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.dtdurations = function(size, decimals) {
|
|
|
- return kbn.toDuration(size, decimals, 'second');
|
|
|
+ return kbn.toDuration(size, decimals, "second");
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.dateTimeAsIso = function(epoch) {
|
|
|
var time = moment(epoch);
|
|
|
|
|
|
- if (moment().isSame(epoch, 'day')) {
|
|
|
- return time.format('HH:mm:ss');
|
|
|
+ if (moment().isSame(epoch, "day")) {
|
|
|
+ return time.format("HH:mm:ss");
|
|
|
}
|
|
|
- return time.format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ return time.format("YYYY-MM-DD HH:mm:ss");
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.dateTimeAsUS = function(epoch) {
|
|
|
var time = moment(epoch);
|
|
|
|
|
|
- if (moment().isSame(epoch, 'day')) {
|
|
|
- return time.format('h:mm:ss a');
|
|
|
+ if (moment().isSame(epoch, "day")) {
|
|
|
+ return time.format("h:mm:ss a");
|
|
|
}
|
|
|
- return time.format('MM/DD/YYYY h:mm:ss a');
|
|
|
+ return time.format("MM/DD/YYYY h:mm:ss a");
|
|
|
};
|
|
|
|
|
|
kbn.valueFormats.dateTimeFromNow = function(epoch) {
|
|
|
@@ -789,228 +890,228 @@ kbn.valueFormats.dateTimeFromNow = function(epoch) {
|
|
|
kbn.getUnitFormats = function() {
|
|
|
return [
|
|
|
{
|
|
|
- text: 'none',
|
|
|
+ text: "none",
|
|
|
submenu: [
|
|
|
- { text: 'none', value: 'none' },
|
|
|
- { text: 'short', value: 'short' },
|
|
|
- { text: 'percent (0-100)', value: 'percent' },
|
|
|
- { text: 'percent (0.0-1.0)', value: 'percentunit' },
|
|
|
- { text: 'Humidity (%H)', value: 'humidity' },
|
|
|
- { text: 'ppm', value: 'ppm' },
|
|
|
- { text: 'decibel', value: 'dB' },
|
|
|
- { text: 'hexadecimal (0x)', value: 'hex0x' },
|
|
|
- { text: 'hexadecimal', value: 'hex' },
|
|
|
- { text: 'scientific notation', value: 'sci' },
|
|
|
- { text: 'locale format', value: 'locale' },
|
|
|
- ],
|
|
|
+ { text: "none", value: "none" },
|
|
|
+ { text: "short", value: "short" },
|
|
|
+ { text: "percent (0-100)", value: "percent" },
|
|
|
+ { text: "percent (0.0-1.0)", value: "percentunit" },
|
|
|
+ { text: "Humidity (%H)", value: "humidity" },
|
|
|
+ { text: "ppm", value: "ppm" },
|
|
|
+ { text: "decibel", value: "dB" },
|
|
|
+ { text: "hexadecimal (0x)", value: "hex0x" },
|
|
|
+ { text: "hexadecimal", value: "hex" },
|
|
|
+ { text: "scientific notation", value: "sci" },
|
|
|
+ { text: "locale format", value: "locale" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'currency',
|
|
|
+ text: "currency",
|
|
|
submenu: [
|
|
|
- { text: 'Dollars ($)', value: 'currencyUSD' },
|
|
|
- { text: 'Pounds (£)', value: 'currencyGBP' },
|
|
|
- { text: 'Euro (€)', value: 'currencyEUR' },
|
|
|
- { text: 'Yen (¥)', value: 'currencyJPY' },
|
|
|
- { text: 'Rubles (₽)', value: 'currencyRUB' },
|
|
|
- { text: 'Hryvnias (₴)', value: 'currencyUAH' },
|
|
|
- { text: 'Real (R$)', value: 'currencyBRL' },
|
|
|
- { text: 'Danish Krone (kr)', value: 'currencyDKK' },
|
|
|
- { text: 'Icelandic Krone (kr)', value: 'currencyISK' },
|
|
|
- { text: 'Norwegian Krone (kr)', value: 'currencyNOK' },
|
|
|
- { text: 'Swedish Krone (kr)', value: 'currencySEK' },
|
|
|
- ],
|
|
|
+ { text: "Dollars ($)", value: "currencyUSD" },
|
|
|
+ { text: "Pounds (£)", value: "currencyGBP" },
|
|
|
+ { text: "Euro (€)", value: "currencyEUR" },
|
|
|
+ { text: "Yen (¥)", value: "currencyJPY" },
|
|
|
+ { text: "Rubles (₽)", value: "currencyRUB" },
|
|
|
+ { text: "Hryvnias (₴)", value: "currencyUAH" },
|
|
|
+ { text: "Real (R$)", value: "currencyBRL" },
|
|
|
+ { text: "Danish Krone (kr)", value: "currencyDKK" },
|
|
|
+ { text: "Icelandic Krone (kr)", value: "currencyISK" },
|
|
|
+ { text: "Norwegian Krone (kr)", value: "currencyNOK" },
|
|
|
+ { text: "Swedish Krone (kr)", value: "currencySEK" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'time',
|
|
|
+ text: "time",
|
|
|
submenu: [
|
|
|
- { text: 'Hertz (1/s)', value: 'hertz' },
|
|
|
- { text: 'nanoseconds (ns)', value: 'ns' },
|
|
|
- { 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' },
|
|
|
- { text: 'duration (ms)', value: 'dtdurationms' },
|
|
|
- { text: 'duration (s)', value: 'dtdurations' },
|
|
|
- ],
|
|
|
+ { text: "Hertz (1/s)", value: "hertz" },
|
|
|
+ { text: "nanoseconds (ns)", value: "ns" },
|
|
|
+ { 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" },
|
|
|
+ { text: "duration (ms)", value: "dtdurationms" },
|
|
|
+ { text: "duration (s)", value: "dtdurations" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'date & time',
|
|
|
+ text: "date & time",
|
|
|
submenu: [
|
|
|
- { text: 'YYYY-MM-DD HH:mm:ss', value: 'dateTimeAsIso' },
|
|
|
- { text: 'DD/MM/YYYY h:mm:ss a', value: 'dateTimeAsUS' },
|
|
|
- { text: 'From Now', value: 'dateTimeFromNow' },
|
|
|
- ],
|
|
|
+ { text: "YYYY-MM-DD HH:mm:ss", value: "dateTimeAsIso" },
|
|
|
+ { text: "DD/MM/YYYY h:mm:ss a", value: "dateTimeAsUS" },
|
|
|
+ { text: "From Now", value: "dateTimeFromNow" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'data (IEC)',
|
|
|
+ text: "data (IEC)",
|
|
|
submenu: [
|
|
|
- { text: 'bits', value: 'bits' },
|
|
|
- { text: 'bytes', value: 'bytes' },
|
|
|
- { text: 'kibibytes', value: 'kbytes' },
|
|
|
- { text: 'mebibytes', value: 'mbytes' },
|
|
|
- { text: 'gibibytes', value: 'gbytes' },
|
|
|
- ],
|
|
|
+ { text: "bits", value: "bits" },
|
|
|
+ { text: "bytes", value: "bytes" },
|
|
|
+ { text: "kibibytes", value: "kbytes" },
|
|
|
+ { text: "mebibytes", value: "mbytes" },
|
|
|
+ { text: "gibibytes", value: "gbytes" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'data (Metric)',
|
|
|
+ text: "data (Metric)",
|
|
|
submenu: [
|
|
|
- { text: 'bits', value: 'decbits' },
|
|
|
- { text: 'bytes', value: 'decbytes' },
|
|
|
- { text: 'kilobytes', value: 'deckbytes' },
|
|
|
- { text: 'megabytes', value: 'decmbytes' },
|
|
|
- { text: 'gigabytes', value: 'decgbytes' },
|
|
|
- ],
|
|
|
+ { text: "bits", value: "decbits" },
|
|
|
+ { text: "bytes", value: "decbytes" },
|
|
|
+ { text: "kilobytes", value: "deckbytes" },
|
|
|
+ { text: "megabytes", value: "decmbytes" },
|
|
|
+ { text: "gigabytes", value: "decgbytes" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'data rate',
|
|
|
+ text: "data rate",
|
|
|
submenu: [
|
|
|
- { text: 'packets/sec', value: 'pps' },
|
|
|
- { text: 'bits/sec', value: 'bps' },
|
|
|
- { text: 'bytes/sec', value: 'Bps' },
|
|
|
- { text: 'kilobits/sec', value: 'Kbits' },
|
|
|
- { text: 'kilobytes/sec', value: 'KBs' },
|
|
|
- { text: 'megabits/sec', value: 'Mbits' },
|
|
|
- { text: 'megabytes/sec', value: 'MBs' },
|
|
|
- { text: 'gigabytes/sec', value: 'GBs' },
|
|
|
- { text: 'gigabits/sec', value: 'Gbits' },
|
|
|
- ],
|
|
|
+ { text: "packets/sec", value: "pps" },
|
|
|
+ { text: "bits/sec", value: "bps" },
|
|
|
+ { text: "bytes/sec", value: "Bps" },
|
|
|
+ { text: "kilobits/sec", value: "Kbits" },
|
|
|
+ { text: "kilobytes/sec", value: "KBs" },
|
|
|
+ { text: "megabits/sec", value: "Mbits" },
|
|
|
+ { text: "megabytes/sec", value: "MBs" },
|
|
|
+ { text: "gigabytes/sec", value: "GBs" },
|
|
|
+ { text: "gigabits/sec", value: "Gbits" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'throughput',
|
|
|
+ text: "throughput",
|
|
|
submenu: [
|
|
|
- { text: 'ops/sec (ops)', value: 'ops' },
|
|
|
- { text: 'reads/sec (rps)', value: 'rps' },
|
|
|
- { text: 'writes/sec (wps)', value: 'wps' },
|
|
|
- { text: 'I/O ops/sec (iops)', value: 'iops' },
|
|
|
- { text: 'ops/min (opm)', value: 'opm' },
|
|
|
- { text: 'reads/min (rpm)', value: 'rpm' },
|
|
|
- { text: 'writes/min (wpm)', value: 'wpm' },
|
|
|
- ],
|
|
|
+ { text: "ops/sec (ops)", value: "ops" },
|
|
|
+ { text: "reads/sec (rps)", value: "rps" },
|
|
|
+ { text: "writes/sec (wps)", value: "wps" },
|
|
|
+ { text: "I/O ops/sec (iops)", value: "iops" },
|
|
|
+ { text: "ops/min (opm)", value: "opm" },
|
|
|
+ { text: "reads/min (rpm)", value: "rpm" },
|
|
|
+ { text: "writes/min (wpm)", value: "wpm" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'length',
|
|
|
+ text: "length",
|
|
|
submenu: [
|
|
|
- { text: 'millimetre (mm)', value: 'lengthmm' },
|
|
|
- { text: 'meter (m)', value: 'lengthm' },
|
|
|
- { text: 'feet (ft)', value: 'lengthft' },
|
|
|
- { text: 'kilometer (km)', value: 'lengthkm' },
|
|
|
- { text: 'mile (mi)', value: 'lengthmi' },
|
|
|
- ],
|
|
|
+ { text: "millimetre (mm)", value: "lengthmm" },
|
|
|
+ { text: "meter (m)", value: "lengthm" },
|
|
|
+ { text: "feet (ft)", value: "lengthft" },
|
|
|
+ { text: "kilometer (km)", value: "lengthkm" },
|
|
|
+ { text: "mile (mi)", value: "lengthmi" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'area',
|
|
|
+ text: "area",
|
|
|
submenu: [
|
|
|
- {text: 'Square Meters (m²)', value: 'areaM2' },
|
|
|
- {text: 'Square Feet (ft²)', value: 'areaF2' },
|
|
|
- {text: 'Square Miles (mi²)', value: 'areaMI2'},
|
|
|
+ { text: "Square Meters (m²)", value: "areaM2" },
|
|
|
+ { text: "Square Feet (ft²)", value: "areaF2" },
|
|
|
+ { text: "Square Miles (mi²)", value: "areaMI2" }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- text: 'mass',
|
|
|
+ text: "mass",
|
|
|
submenu: [
|
|
|
- { text: 'milligram (mg)', value: 'massmg' },
|
|
|
- { text: 'gram (g)', value: 'massg' },
|
|
|
- { text: 'kilogram (kg)', value: 'masskg' },
|
|
|
- { text: 'metric ton (t)', value: 'masst' },
|
|
|
- ],
|
|
|
+ { text: "milligram (mg)", value: "massmg" },
|
|
|
+ { text: "gram (g)", value: "massg" },
|
|
|
+ { text: "kilogram (kg)", value: "masskg" },
|
|
|
+ { text: "metric ton (t)", value: "masst" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'velocity',
|
|
|
+ text: "velocity",
|
|
|
submenu: [
|
|
|
- { text: 'm/s', value: 'velocityms' },
|
|
|
- { text: 'km/h', value: 'velocitykmh' },
|
|
|
- { text: 'mph', value: 'velocitymph' },
|
|
|
- { text: 'knot (kn)', value: 'velocityknot' },
|
|
|
- ],
|
|
|
+ { text: "m/s", value: "velocityms" },
|
|
|
+ { text: "km/h", value: "velocitykmh" },
|
|
|
+ { text: "mph", value: "velocitymph" },
|
|
|
+ { text: "knot (kn)", value: "velocityknot" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'volume',
|
|
|
+ text: "volume",
|
|
|
submenu: [
|
|
|
- { text: 'millilitre', value: 'mlitre' },
|
|
|
- { text: 'litre', value: 'litre' },
|
|
|
- { text: 'cubic metre', value: 'm3' },
|
|
|
- { text: 'cubic decimetre', value: 'dm3' },
|
|
|
- { text: 'gallons', value: 'gallons' },
|
|
|
- ],
|
|
|
+ { text: "millilitre", value: "mlitre" },
|
|
|
+ { text: "litre", value: "litre" },
|
|
|
+ { text: "cubic metre", value: "m3" },
|
|
|
+ { text: "cubic decimetre", value: "dm3" },
|
|
|
+ { text: "gallons", value: "gallons" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'energy',
|
|
|
+ text: "energy",
|
|
|
submenu: [
|
|
|
- { text: 'Watt (W)', value: 'watt' },
|
|
|
- { text: 'Kilowatt (kW)', value: 'kwatt' },
|
|
|
- { text: 'Milliwatt (mW)', value: 'mwatt' },
|
|
|
- { text: 'Volt-ampere (VA)', value: 'voltamp' },
|
|
|
- { text: 'Kilovolt-ampere (kVA)', value: 'kvoltamp' },
|
|
|
- { text: 'Volt-ampere reactive (var)', value: 'voltampreact' },
|
|
|
- { text: 'Kilovolt-ampere reactive (kvar)', value: 'kvoltampreact' },
|
|
|
- { text: 'Watt-hour (Wh)', value: 'watth' },
|
|
|
- { text: 'Kilowatt-hour (kWh)', value: 'kwatth' },
|
|
|
- { text: 'Kilowatt-min (kWm)', value: 'kwattm' },
|
|
|
- { text: 'Joule (J)', value: 'joule' },
|
|
|
- { text: 'Electron volt (eV)', value: 'ev' },
|
|
|
- { text: 'Ampere (A)', value: 'amp' },
|
|
|
- { text: 'Kiloampere (kA)', value: 'kamp' },
|
|
|
- { text: 'Milliampere (mA)', value: 'mamp' },
|
|
|
- { text: 'Volt (V)', value: 'volt' },
|
|
|
- { text: 'Kilovolt (kV)', value: 'kvolt' },
|
|
|
- { text: 'Millivolt (mV)', value: 'mvolt' },
|
|
|
- { text: 'Decibel-milliwatt (dBm)', value: 'dBm' },
|
|
|
- { text: 'Ohm (Ω)', value: 'ohm' }
|
|
|
- ],
|
|
|
+ { text: "Watt (W)", value: "watt" },
|
|
|
+ { text: "Kilowatt (kW)", value: "kwatt" },
|
|
|
+ { text: "Milliwatt (mW)", value: "mwatt" },
|
|
|
+ { text: "Volt-ampere (VA)", value: "voltamp" },
|
|
|
+ { text: "Kilovolt-ampere (kVA)", value: "kvoltamp" },
|
|
|
+ { text: "Volt-ampere reactive (var)", value: "voltampreact" },
|
|
|
+ { text: "Kilovolt-ampere reactive (kvar)", value: "kvoltampreact" },
|
|
|
+ { text: "Watt-hour (Wh)", value: "watth" },
|
|
|
+ { text: "Kilowatt-hour (kWh)", value: "kwatth" },
|
|
|
+ { text: "Kilowatt-min (kWm)", value: "kwattm" },
|
|
|
+ { text: "Joule (J)", value: "joule" },
|
|
|
+ { text: "Electron volt (eV)", value: "ev" },
|
|
|
+ { text: "Ampere (A)", value: "amp" },
|
|
|
+ { text: "Kiloampere (kA)", value: "kamp" },
|
|
|
+ { text: "Milliampere (mA)", value: "mamp" },
|
|
|
+ { text: "Volt (V)", value: "volt" },
|
|
|
+ { text: "Kilovolt (kV)", value: "kvolt" },
|
|
|
+ { text: "Millivolt (mV)", value: "mvolt" },
|
|
|
+ { text: "Decibel-milliwatt (dBm)", value: "dBm" },
|
|
|
+ { text: "Ohm (Ω)", value: "ohm" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'temperature',
|
|
|
+ text: "temperature",
|
|
|
submenu: [
|
|
|
- { text: 'Celsius (°C)', value: 'celsius' },
|
|
|
- { text: 'Farenheit (°F)', value: 'farenheit' },
|
|
|
- { text: 'Kelvin (K)', value: 'kelvin' },
|
|
|
- ],
|
|
|
+ { text: "Celsius (°C)", value: "celsius" },
|
|
|
+ { text: "Farenheit (°F)", value: "farenheit" },
|
|
|
+ { text: "Kelvin (K)", value: "kelvin" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'pressure',
|
|
|
+ text: "pressure",
|
|
|
submenu: [
|
|
|
- { text: 'Millibars', value: 'pressurembar' },
|
|
|
- { text: 'Bars', value: 'pressurebar' },
|
|
|
- { text: 'Kilobars', value: 'pressurekbar' },
|
|
|
- { text: 'Hectopascals', value: 'pressurehpa' },
|
|
|
- { text: 'Inches of mercury', value: 'pressurehg' },
|
|
|
- { text: 'PSI', value: 'pressurepsi' },
|
|
|
- ],
|
|
|
+ { text: "Millibars", value: "pressurembar" },
|
|
|
+ { text: "Bars", value: "pressurebar" },
|
|
|
+ { text: "Kilobars", value: "pressurekbar" },
|
|
|
+ { text: "Hectopascals", value: "pressurehpa" },
|
|
|
+ { text: "Inches of mercury", value: "pressurehg" },
|
|
|
+ { text: "PSI", value: "pressurepsi" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'force',
|
|
|
+ text: "force",
|
|
|
submenu: [
|
|
|
- { text: 'Newton-meters (Nm)', value: 'forceNm' },
|
|
|
- { text: 'Kilonewton-meters (kNm)', value: 'forcekNm' },
|
|
|
- { text: 'Newtons (N)', value: 'forceN' },
|
|
|
- { text: 'Kilonewtons (kN)', value: 'forcekN' },
|
|
|
- ],
|
|
|
+ { text: "Newton-meters (Nm)", value: "forceNm" },
|
|
|
+ { text: "Kilonewton-meters (kNm)", value: "forcekNm" },
|
|
|
+ { text: "Newtons (N)", value: "forceN" },
|
|
|
+ { text: "Kilonewtons (kN)", value: "forcekN" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'flow',
|
|
|
+ text: "flow",
|
|
|
submenu: [
|
|
|
- { text: 'Gallons/min (gpm)', value: 'flowgpm' },
|
|
|
- { text: 'Cubic meters/sec (cms)', value: 'flowcms' },
|
|
|
- { text: 'Cubic feet/sec (cfs)', value: 'flowcfs' },
|
|
|
- { text: 'Cubic feet/min (cfm)', value: 'flowcfm' },
|
|
|
- ],
|
|
|
+ { text: "Gallons/min (gpm)", value: "flowgpm" },
|
|
|
+ { text: "Cubic meters/sec (cms)", value: "flowcms" },
|
|
|
+ { text: "Cubic feet/sec (cfs)", value: "flowcfs" },
|
|
|
+ { text: "Cubic feet/min (cfm)", value: "flowcfm" }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- text: 'angle',
|
|
|
+ text: "angle",
|
|
|
submenu: [
|
|
|
- { text: 'Degrees (°)', value: 'degree' },
|
|
|
- { text: 'Radians', value: 'radian' },
|
|
|
- { text: 'Gradian', value: 'grad' }
|
|
|
+ { text: "Degrees (°)", value: "degree" },
|
|
|
+ { text: "Radians", value: "radian" },
|
|
|
+ { text: "Gradian", value: "grad" }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- text: 'acceleration',
|
|
|
+ text: "acceleration",
|
|
|
submenu: [
|
|
|
- { text: 'Meters/sec²', value: 'accMS2' },
|
|
|
- { text: 'Feet/sec²', value: 'accFS2' },
|
|
|
- { text: 'G unit', value: 'accG' }
|
|
|
+ { text: "Meters/sec²", value: "accMS2" },
|
|
|
+ { text: "Feet/sec²", value: "accFS2" },
|
|
|
+ { text: "G unit", value: "accG" }
|
|
|
]
|
|
|
}
|
|
|
];
|