MediaWiki:Common.js: Difference between revisions
Appearance
Dinkelspiel (talk | contribs) Created page with "document.addEventListener('DOMContentLoaded', function () { const ctx1 = document.getElementById("maxPlayerChart"); const init1 = async () => { const data = ( await ( await fetch( "https://goldenage.keii.dev/api/servers/1/statistics/max-player-count", ) ).json() )["data"]; new Chart(ctx1, { type: "line", data: {..." |
(No difference)
|
Revision as of 11:05, 31 July 2025
document.addEventListener('DOMContentLoaded', function () {
const ctx1 =
document.getElementById("maxPlayerChart");
const init1 = async () => {
const data = (
await (
await fetch(
"https://goldenage.keii.dev/api/servers/1/statistics/max-player-count",
)
).json()
)["data"];
new Chart(ctx1, {
type: "line",
data: {
labels: data.map((row) =>
new Date(row.Date).toDateString(),
),
datasets: [
{
label: "Max Player Count",
data: data.map(
(row) => row.MaxPlayerCount,
),
borderWidth: 1,
},
],
},
options: {
scales: {
y: {
beginAtZero: true,
},
},
},
});
};
init1();
});