set const maxValue = Math.max(...winDistribution)

This commit is contained in:
Jacob Louis Hoover 2022-01-25 13:11:04 -05:00 committed by GitHub
parent b5bfad1104
commit 8d42c8d763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,8 @@ type Props = {
}
export const Histogram = ({ gameStats }: Props) => {
const { totalGames, winDistribution } = gameStats
const winDistribution = gameStats.winDistribution
const maxValue = Math.max(...winDistribution)
return (
<div className="columns-1 justify-left m-2 text-sm">
@ -14,7 +15,7 @@ export const Histogram = ({ gameStats }: Props) => {
<Progress
key={i}
index={i}
size={95 * (value / Math.max(...winDistribution))}
size={90 * (value / maxValue)}
label={String(value)}
/>
))}