diff --git a/TODO b/TODO index 842f5a18c..1da5b1b3d 100644 --- a/TODO +++ b/TODO @@ -8,8 +8,6 @@ Don't allow play if versions in tabs don't match - close worker? - newPhasePreseason being called twice in two different tabs and somehow updating the database twice? -on trade graphs, don't use 0% and 100% as limits for wins graph https://discord.com/channels/290013534023057409/331882115119448065/1295991083637149829 - wOBA, wrc, wrc+ option to hide jersey numbers on team history page https://discord.com/channels/290013534023057409/331882115119448065/1295583496084914277 diff --git a/src/ui/views/TradeSummary/Charts.tsx b/src/ui/views/TradeSummary/Charts.tsx index 30c108900..0cbb64fb3 100644 --- a/src/ui/views/TradeSummary/Charts.tsx +++ b/src/ui/views/TradeSummary/Charts.tsx @@ -247,13 +247,21 @@ const Charts = ({ View<"tradeSummary">, "phase" | "season" | "seasonsToPlot" | "stat" | "teams" | "usePts" >) => { + const pctKey = usePts ? "ptsPct" : "winp"; + const allStats: number[] = []; + const allPcts: number[] = []; const seasons: number[] = []; for (const row of seasonsToPlot) { for (const team of row.teams) { if (team.stat !== undefined) { allStats.push(team.stat); + + const pct = team[pctKey]; + if (pct !== undefined) { + allPcts.push(pct); + } } } seasons.push(row.season); @@ -261,8 +269,9 @@ const Charts = ({ const xDomain = [seasons[0], seasons.at(-1)] as [number, number]; + const yDomainPct = [Math.min(0.25, ...allPcts), Math.max(0.75, ...allPcts)]; const yScale = scaleLinear({ - domain: [0, 1], + domain: yDomainPct, range: [HEIGHT, 0], }); @@ -284,7 +293,7 @@ const Charts = ({ usePts ? "point" : "winning" } percentages before and after the trade`} - valueKey={usePts ? "ptsPct" : "winp"} + valueKey={pctKey} xDomain={xDomain} yScale={yScale} yTickFormat={helpers.roundWinp}