diff --git a/packages/components/src/components/DistributionChart.tsx b/packages/components/src/components/DistributionChart.tsx index 18dd2a3e..276e73d5 100644 --- a/packages/components/src/components/DistributionChart.tsx +++ b/packages/components/src/components/DistributionChart.tsx @@ -153,6 +153,7 @@ type SummaryTableProps = { const SummaryTable: React.FC = ({ distribution }) => { const mean = distribution.mean(); + const stdev = distribution.stdev(); const p5 = distribution.inv(0.05); const p10 = distribution.inv(0.1); const p25 = distribution.inv(0.25); @@ -161,6 +162,9 @@ const SummaryTable: React.FC = ({ distribution }) => { const p90 = distribution.inv(0.9); const p95 = distribution.inv(0.95); + const hasResult = (x: result): boolean => + x.tag === "Ok"; + const unwrapResult = ( x: result ): React.ReactNode => { @@ -180,6 +184,7 @@ const SummaryTable: React.FC = ({ distribution }) => { {"Mean"} + {hasResult(stdev) && {"Stdev"}} {"5%"} {"10%"} {"25%"} @@ -192,6 +197,7 @@ const SummaryTable: React.FC = ({ distribution }) => { {unwrapResult(mean)} + {hasResult(stdev) && {unwrapResult(stdev)}} {unwrapResult(p5)} {unwrapResult(p10)} {unwrapResult(p25)}