Migrate to dayjs and Astro 4.0
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user