Skip to content

Commit cc268ba

Browse files
authored
Merge pull request #407 from DigitalSlideArchive/plot-number-format
Don't show decimal places on integers
2 parents ab00745 + 55de3fe commit cc268ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

histomicsui/web_client/panels/MetadataPlot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ var MetadataPlot = Panel.extend({
331331
if (!significant || significant < 1) {
332332
significant = 3;
333333
}
334-
const digits = Math.min(significant, Math.max(0, significant - Math.floor(Math.log10(Math.abs(val)))));
334+
let digits = Math.min(significant, Math.max(0, significant - Math.floor(Math.log10(Math.abs(val)))));
335+
if (parseFloat(val) === parseInt(val, 10)) {
336+
digits = 0;
337+
}
335338
return val.toFixed(digits);
336339
},
337340

0 commit comments

Comments
 (0)