From 114cb1abe9f1466390d464bb2dc8d17cea3ed68c Mon Sep 17 00:00:00 2001 From: beerpsi <92439990+beer-psi@users.noreply.github.com> Date: Mon, 5 Oct 2026 02:07:07 +0700 Subject: [PATCH] Add dynamic baselines for maimai/CHUNITHM score graphs (#1752) --- .../charts/GekichumaiScoreChart.tsx | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/typescript/client/src/components/charts/GekichumaiScoreChart.tsx b/typescript/client/src/components/charts/GekichumaiScoreChart.tsx index f9946b6f1..f68e7e144 100644 --- a/typescript/client/src/components/charts/GekichumaiScoreChart.tsx +++ b/typescript/client/src/components/charts/GekichumaiScoreChart.tsx @@ -71,21 +71,18 @@ const getScoreYAxisNotch = (game: GameGroup) => (s: number) => { return ""; }; -const getBaseline = (_game: "ongeki", data: Serie[]) => { +const getBaseline = (data: Serie[], tickValues: number[]) => { const dataset = data[0].data; const dv = dataset[dataset.length - 1].y; const finalValue: number = typeof dv === "number" ? dv : 0; - if (finalValue >= 1007_500) { - return 1007_500; + for (let i = tickValues.length - 1; i >= 0; i--) { + if (finalValue >= tickValues[i]) { + return tickValues[i]; + } } - if (finalValue >= 1000_000) { - return 1000_000; - } - if (finalValue >= 990_000) { - return 990_000; - } - return 970_000; + + return tickValues[0]; }; const strokeColor = ( @@ -255,13 +252,15 @@ export default function GekichumaiScoreChart({ if (type === "Score") { if (game === "ongeki") { - const baseline = getBaseline("ongeki", data); + const tickValues = [970_000, 990_000, 1000_000, 1007_500, 1010_000]; + const baseline = getBaseline(data, tickValues); + component = ( ); } else if (game === "chunithm") { + const tickValues = [990_000, 1000_000, 1005_000, 1007_500, 1009_000, 1010_000]; + const baseline = getBaseline(data, tickValues); + component = ( ); } else if (game === "maimaidx") { + const tickValues = [97, 98, 99, 99.5, 100, 100.5, 101]; + const baseline = getBaseline(data, tickValues); + component = (