Make numeric chart bucket points less wrong
This commit is contained in:
parent
a94864d974
commit
6b9b0760b1
|
@ -12,10 +12,9 @@ import { useElementWidth } from 'web/hooks/use-element-width'
|
||||||
|
|
||||||
const getNumericChartData = (contract: NumericContract) => {
|
const getNumericChartData = (contract: NumericContract) => {
|
||||||
const { totalShares, bucketCount, min, max } = contract
|
const { totalShares, bucketCount, min, max } = contract
|
||||||
|
const step = (max - min) / bucketCount
|
||||||
const bucketProbs = getDpmOutcomeProbabilities(totalShares)
|
const bucketProbs = getDpmOutcomeProbabilities(totalShares)
|
||||||
const xs = range(bucketCount).map(
|
const xs = range(bucketCount).map((i) => min + step * (i + 0.5))
|
||||||
(i) => min + ((max - min) * i) / bucketCount
|
|
||||||
)
|
|
||||||
const probs = range(bucketCount).map((i) => bucketProbs[`${i}`])
|
const probs = range(bucketCount).map((i) => bucketProbs[`${i}`])
|
||||||
return probs.map((prob, i) => [xs[i], prob] as const)
|
return probs.map((prob, i) => [xs[i], prob] as const)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user