From 45a0638b7e4e89e766974952b0a17faa4c9e229b Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Fri, 5 Jun 2026 10:39:35 -0600 Subject: [PATCH] fix --- src/oj/submission/list.vue | 4 +- .../components/FlowchartStatisticsPanel.vue | 38 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/oj/submission/list.vue b/src/oj/submission/list.vue index edccf8f..341c0d9 100644 --- a/src/oj/submission/list.vue +++ b/src/oj/submission/list.vue @@ -405,7 +405,9 @@ const flowchartColumns = computed(() => { diff --git a/src/shared/components/FlowchartStatisticsPanel.vue b/src/shared/components/FlowchartStatisticsPanel.vue index 1a67a0e..1d6ef82 100644 --- a/src/shared/components/FlowchartStatisticsPanel.vue +++ b/src/shared/components/FlowchartStatisticsPanel.vue @@ -437,31 +437,43 @@ const criteriaBarChartData = computed(() => { { label: "平均得分", data: labels.map((k) => data.criteria_averages[k]?.avg ?? 0), - backgroundColor: "rgba(32, 128, 240, 0.6)", - borderColor: "rgba(32, 128, 240, 1)", + backgroundColor: labels.map( + (_, i) => GRADE_COLORS[["S", "A", "B", "C"][i]].bg, + ), + borderColor: labels.map( + (_, i) => GRADE_COLORS[["S", "A", "B", "C"][i]].border, + ), borderWidth: 2, }, - { - label: "满分", - data: labels.map((k) => data.criteria_averages[k]?.max ?? 0), - backgroundColor: "rgba(200, 200, 200, 0.3)", - borderColor: "rgba(150, 150, 150, 0.8)", - borderWidth: 1, - }, ], } }) -const barOptions = { +const barYMax = computed(() => { + const maxes = CRITERIA_ORDER.map((k) => data.criteria_averages[k]?.max ?? 0) + return Math.max(...maxes, 10) +}) + +const barOptions = computed(() => ({ responsive: true, maintainAspectRatio: false, scales: { - y: { beginAtZero: true }, + y: { beginAtZero: true, max: barYMax.value }, }, plugins: { - legend: { position: "bottom" as const }, + legend: { display: false }, + tooltip: { + callbacks: { + label(context: any) { + const key = context.label + const item = data.criteria_averages[key] + if (!item) return "" + return `${item.avg} / ${item.max}` + }, + }, + }, }, -} +})) const WORD_COLORS = [ "#2080f0",