From 7fa11bdc4ea1f2f4e22eda071ae621b8ee81e7a4 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Mon, 26 Sep 2022 17:39:23 -0700 Subject: [PATCH] Clean up numeric bucket computation --- web/components/charts/contract/numeric.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/components/charts/contract/numeric.tsx b/web/components/charts/contract/numeric.tsx index d992362f..e45d7f54 100644 --- a/web/components/charts/contract/numeric.tsx +++ b/web/components/charts/contract/numeric.tsx @@ -14,9 +14,9 @@ const getNumericChartData = (contract: NumericContract) => { const { totalShares, bucketCount, min, max } = contract const step = (max - min) / bucketCount const bucketProbs = getDpmOutcomeProbabilities(totalShares) - const xs = range(bucketCount).map((i) => min + step * (i + 0.5)) - const probs = range(bucketCount).map((i) => bucketProbs[`${i}`]) - return probs.map((prob, i) => [xs[i], prob] as const) + return range(bucketCount).map( + (i) => [min + step * (i + 0.5), bucketProbs[`${i}`]] as const + ) } export const NumericContractChart = (props: {