document.addEventListener("DOMContentLoaded", () => { fetch("/admin/data") .then((resp) => resp.json()) .then((data) => { document.querySelector("#backlog").textContent = data.backlog; new Chart(document.getElementById("schedule"), { type: "bar", data: { labels: data.schedule.map((row) => luxon.DateTime.fromISO(row.time_key) ), datasets: [ { label: "Reminders", data: data.schedule.map((row) => row.count), }, ], }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { type: "time", time: { unit: "minute", }, }, }, }, }); new Chart(document.getElementById("scheduleLong"), { type: "bar", data: { labels: data.scheduleLong.map((row) => luxon.DateTime.fromISO(row.time_key) ), datasets: [ { label: "Reminders", data: data.scheduleLong.map((row) => row.count), }, ], }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { type: "time", time: { unit: "day", }, }, }, }, }); }); });