From f2827f85eb71942bbe905b5d83fefaddc3df8e7d Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Fri, 5 Jun 2026 00:31:30 +0200 Subject: [PATCH] feat/frontend: show winrates along pickrates in tierlist --- frontend/components/tierlist/Chart.vue | 20 +++++++++++++------- frontend/pages/tierlist/[lane].vue | 14 +++++++++++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/frontend/components/tierlist/Chart.vue b/frontend/components/tierlist/Chart.vue index 12f0763..d2cbf08 100644 --- a/frontend/components/tierlist/Chart.vue +++ b/frontend/components/tierlist/Chart.vue @@ -16,12 +16,18 @@ import type { LaneData } from 'match_collector' // Register ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale) -const props = defineProps<{ - data: Array<{ title: string; data: Array<{ lane: LaneData; champion: Champion }> }> -}>() +const props = withDefaults( + defineProps<{ + data: Array<{ title: string; data: Array<{ lane: LaneData; champion: Champion }> }> + metric?: 'pickrate' | 'winrate' + }>(), + { + metric: 'pickrate' + } +) const labels: Array = [] -const pickrates: Array = [] +const values: Array = [] const images: Array = [] const backgroundColors: Array = [] const CHAMPION_CUT_THRESHOLD = 32 @@ -34,7 +40,7 @@ for (const tier of props.data) { if (count > CHAMPION_CUT_THRESHOLD) break labels.push(champion.name) - pickrates.push(lane.pickrate * 100) + values.push(lane[props.metric] * 100) images.push(CDRAGON_BASE + mapPath(champion.squarePortraitPath)) backgroundColors.push(TIER_COLORS[colorIndex]) @@ -47,10 +53,10 @@ const chartData = ref({ labels: labels, datasets: [ { - label: 'Pickrate', + label: props.metric === 'pickrate' ? 'Pickrate' : 'Winrate', backgroundColor: backgroundColors, barPercentage: 1.0, - data: pickrates + data: values } ] }) diff --git a/frontend/pages/tierlist/[lane].vue b/frontend/pages/tierlist/[lane].vue index eae74ed..de37e2e 100644 --- a/frontend/pages/tierlist/[lane].vue +++ b/frontend/pages/tierlist/[lane].vue @@ -110,14 +110,21 @@ tiers.push({ title: 'F', data: tierFromScaledPickrate(0, 0.1) }) :tier="tier.data" /> - +

+ Pickrates +

+ + +

Winrates

+