From 38882eae55456ec5b24edc53364383717f237e5a Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Mon, 5 Aug 2024 20:43:00 +0000 Subject: [PATCH 1/2] Improve formatting of draws table --- gui/src/app/SamplerOutputView/SamplerOutputView.tsx | 2 +- gui/src/draws-table.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/src/app/SamplerOutputView/SamplerOutputView.tsx b/gui/src/app/SamplerOutputView/SamplerOutputView.tsx index ff26ce67..5e12534d 100644 --- a/gui/src/app/SamplerOutputView/SamplerOutputView.tsx +++ b/gui/src/app/SamplerOutputView/SamplerOutputView.tsx @@ -174,7 +174,7 @@ const DrawsView: FunctionComponent = ({ {drawChainIds[i]} {drawNumbers[i]} {draws.map((draw, j) => ( - {draw[i]} + {draw[i].toPrecision(6)} ))} ))} diff --git a/gui/src/draws-table.css b/gui/src/draws-table.css index b04a7de0..cf794c18 100644 --- a/gui/src/draws-table.css +++ b/gui/src/draws-table.css @@ -22,6 +22,7 @@ .draws-table th, .draws-table td { padding: 2px 2px; + white-space: nowrap; } .draws-table tbody tr { From ec3427158e7a592a7c80ac1036737eb3ebff63a1 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 6 Aug 2024 13:50:20 +0000 Subject: [PATCH 2/2] Fix formatting of integer columns --- gui/src/app/SamplerOutputView/SamplerOutputView.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gui/src/app/SamplerOutputView/SamplerOutputView.tsx b/gui/src/app/SamplerOutputView/SamplerOutputView.tsx index 5e12534d..5e8dbb20 100644 --- a/gui/src/app/SamplerOutputView/SamplerOutputView.tsx +++ b/gui/src/app/SamplerOutputView/SamplerOutputView.tsx @@ -108,7 +108,9 @@ const DrawsView: FunctionComponent = ({ >(300); const draws2 = useMemo(() => { if (abbreviatedToNumRows === undefined) return draws; - return draws.map((draw) => draw.slice(0, abbreviatedToNumRows)); + return draws.map((draw) => + formatDraws(draw.slice(0, abbreviatedToNumRows)), + ); }, [draws, abbreviatedToNumRows]); const handleExportToCsv = useCallback(() => { const csvText = prepareCsvText( @@ -173,8 +175,8 @@ const DrawsView: FunctionComponent = ({ {drawChainIds[i]} {drawNumbers[i]} - {draws.map((draw, j) => ( - {draw[i].toPrecision(6)} + {draws2.map((draw, j) => ( + {draw[i]} ))} ))} @@ -196,6 +198,11 @@ const DrawsView: FunctionComponent = ({ ); }; +const formatDraws = (draws: number[]) => { + if (draws.every((x) => Number.isInteger(x))) return draws; + return draws.map((x) => x.toPrecision(6)); +}; + const prepareCsvText = ( draws: number[][], paramNames: string[],