mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Profiling] allow negative numbers in formatter (#143420)
* Update as_number.ts allow negative numbers in formatter. Currently all negative values get truncated to `~0.00` closes https://github.com/elastic/prodfiler/issues/2707 * Update as_number.ts * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * Update as_number.ts change negative condition to abs Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
This commit is contained in:
parent
76e9dd4d1f
commit
003bbf7f2d
1 changed files with 4 additions and 4 deletions
|
@ -11,18 +11,18 @@ export function asNumber(value: number): string {
|
|||
}
|
||||
|
||||
value = Math.round(value * 100) / 100;
|
||||
if (value < 0.01) {
|
||||
if (Math.abs(value) < 0.01) {
|
||||
return '~0.00';
|
||||
}
|
||||
if (value < 1e3) {
|
||||
if (Math.abs(value) < 1e3) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
if (value < 1e6) {
|
||||
if (Math.abs(value) < 1e6) {
|
||||
return `${asNumber(value / 1e3)}k`;
|
||||
}
|
||||
|
||||
if (value < 1e9) {
|
||||
if (Math.abs(value) < 1e9) {
|
||||
return `${asNumber(value / 1e6)}m`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue