Migrate to dayjs and Astro 4.0

This commit is contained in:
2023-12-07 00:17:32 +01:00
parent 505ee26622
commit 311856415e
24 changed files with 731 additions and 980 deletions

View File

@@ -12,10 +12,10 @@
Title
} from "chart.js"
import type {FightStats} from "./types/stats.ts"
import 'chartjs-adapter-moment'
import 'chartjs-adapter-dayjs-4'
export let data: FightStats;
let chart;
let chart: Chart;
let canvas: HTMLCanvasElement;
onMount(async () => {
@@ -25,13 +25,7 @@
}
const colors = ["#abfa91", "#279900", "#00ffbe", "#9297fb", "#050b9d", "#b60fff", "#8dddfc", "#0880ad", "#41ff00", "#039973", "#96fce2", "#0009ff", "#7501a4", "#e2a2fb", "#00b9ff"];
const map = new Map<string, {x: Date, y: number}[]>()
for (const {date, count, gamemode} of data) {
if (!map.has(gamemode)) {
map.set(gamemode, [])
}
map.get(gamemode)!!.push({x: new Date(date), y: count})
}
const map = Map.groupBy(data, entry => entry.gamemode);
chart = new Chart(
canvas,