in client/client/modules/render/utilities/numberFormatter.js [32:94]
static textWithPrefix(value, displayFractionDigits = true, prefixMap = null){
if (value === 0)
return '1';
let module = NumberFormatter.findClosestDecimalDegree(value, 1);
const moduleStep = 3;
module = Math.floor(module / moduleStep) * moduleStep;
const decimalBase = 10;
let valueCorrected = Math.floor(value / (decimalBase ** (module - 1))) / decimalBase;
if (!displayFractionDigits){
valueCorrected = Math.floor(value / (decimalBase ** module));
}
let prefix = null;
const K = 3;
const M = 6;
const G = 9;
const T = 12;
const P = 15;
if (module === K){
if (prefixMap && prefixMap.K) {
prefix = prefixMap.K;
} else {
prefix = 'K';
}
}
else if (module === M){
if (prefixMap && prefixMap.M) {
prefix = prefixMap.M;
} else {
prefix = 'M';
}
}
else if (module === G){
if (prefixMap && prefixMap.G) {
prefix = prefixMap.G;
} else {
prefix = 'G';
}
}
else if (module === T){
if (prefixMap && prefixMap.T) {
prefix = prefixMap.T;
} else {
prefix = 'T';
}
}
else if (module === P){
if (prefixMap && prefixMap.P) {
prefix = prefixMap.P;
} else {
prefix = 'P';
}
}
if (!prefix && prefixMap && prefixMap.units) {
prefix = prefixMap.units;
}
if (prefix){
return NumberFormatter.formattedText(valueCorrected) + prefix;
}
return value;
}