We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eebb926 commit 4fedb2eCopy full SHA for 4fedb2e
src/e3sm_quickview/module/serve/utils.js
@@ -6,6 +6,21 @@ window.trame.utils.quickview = {
6
if (useLog && value > 0) {
7
return `10^(${Math.log10(value).toFixed(1)})`;
8
}
9
+ const nSignDigit = Math.log10(Math.abs(value));
10
+ if (Math.abs(nSignDigit) < 6 || value === 0) {
11
+ if (nSignDigit > 0 && nSignDigit < 3) {
12
+ return new Intl.NumberFormat("US", { maximumFractionDigits: 2 }).format(
13
+ value,
14
+ );
15
+ }
16
+ if (nSignDigit > 3) {
17
+ return new Intl.NumberFormat("US", { maximumFractionDigits: 0 }).format(
18
19
20
21
+
22
+ return new Intl.NumberFormat().format(value);
23
24
return value.toExponential(1);
25
},
26
cols(size) {
0 commit comments