diff --git a/treemap/app/src/main.js b/treemap/app/src/main.js index a4176e59d830..ffb4c1951d44 100644 --- a/treemap/app/src/main.js +++ b/treemap/app/src/main.js @@ -589,7 +589,8 @@ class TreemapViewer { ]; if (bytes !== undefined && total !== undefined) { - const percentStr = TreemapUtil.i18n.formatPercent(bytes / total); + const percent = total === 0 ? 1 : bytes / total; + const percentStr = TreemapUtil.i18n.formatPercent(percent); let str = `${TreemapUtil.i18n.formatBytesWithBestUnit(bytes)} (${percentStr})`; // Only add label for bytes on the root node. if (node === this.currentTreemapRoot) {