From ca0965015119f6db377f681c6bba6db14661a8c8 Mon Sep 17 00:00:00 2001 From: Sam Nolan Date: Mon, 9 May 2022 19:55:57 +0000 Subject: [PATCH] Fix number formatting for summary tables --- .../src/components/DistributionChart.tsx | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/components/src/components/DistributionChart.tsx b/packages/components/src/components/DistributionChart.tsx index 43702aaf..27dbf4b8 100644 --- a/packages/components/src/components/DistributionChart.tsx +++ b/packages/components/src/components/DistributionChart.tsx @@ -17,6 +17,7 @@ import { expYScale, } from "./DistributionVegaScales"; import styled from "styled-components"; +import { NumberShower } from "./NumberShower"; type DistributionChartProps = { distribution: Distribution; @@ -179,24 +180,18 @@ const SummaryTable: React.FC = ({ distribution, }: SummaryTableProps) => { let mean = distribution.mean(); - let median = distribution.inv(0.5); let p5 = distribution.inv(0.05); let p10 = distribution.inv(0.1); - let Q1 = distribution.inv(0.25); - let Q3 = distribution.inv(0.75); + let p25 = distribution.inv(0.25); + let p50 = distribution.inv(0.5); + let p75 = distribution.inv(0.75); let p90 = distribution.inv(0.9); let p95 = distribution.inv(0.95); let unwrapResult = ( x: result ): React.ReactNode => { if (x.tag === "Ok") { - return ( - - {Intl.NumberFormat("en-US", { maximumSignificantDigits: 3 }).format( - x.value - )} - - ); + return ; } else { return ( @@ -225,9 +220,9 @@ const SummaryTable: React.FC = ({ {unwrapResult(mean)} {unwrapResult(p5)} {unwrapResult(p10)} - {unwrapResult(Q1)} - {unwrapResult(median)} - {unwrapResult(Q3)} + {unwrapResult(p25)} + {unwrapResult(p50)} + {unwrapResult(p75)} {unwrapResult(p90)} {unwrapResult(p95)}