feat/frontend: show winrates along pickrates in tierlist
pipeline / lint-and-format (push) Failing after 16m35s
pipeline / build-and-push-images (push) Has been skipped

This commit is contained in:
2026-06-05 00:31:30 +02:00
parent 0224b7812c
commit f2827f85eb
2 changed files with 24 additions and 10 deletions
+13 -7
View File
@@ -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<string> = []
const pickrates: Array<number> = []
const values: Array<number> = []
const images: Array<string> = []
const backgroundColors: Array<string> = []
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
}
]
})