|
|
@ -16,15 +16,30 @@ const x_scale = { |
|
|
|
ticks: { |
|
|
|
ticks: { |
|
|
|
callback: (value, index, ticks) => { |
|
|
|
callback: (value, index, ticks) => { |
|
|
|
let tickdate = new Date(value); |
|
|
|
let tickdate = new Date(value); |
|
|
|
if (index === 0) return `${tickdate.getDate()}.${tickdate.getMonth() + 1}.`; |
|
|
|
if (index === 0) return `${tickdate.getDate()}.${month_names[tickdate.getMonth()]}`; |
|
|
|
let prev_tickdate = new Date(ticks[index-1].value); |
|
|
|
let prev_tickdate = new Date(ticks[index-1].value); |
|
|
|
if (prev_tickdate.getDate() === tickdate.getDate()) { |
|
|
|
if (prev_tickdate.getDate() === tickdate.getDate()) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
return `${tickdate.getDate()}.${tickdate.getMonth() + 1}.`; |
|
|
|
return `${tickdate.getDate()}.${month_names[tickdate.getMonth()]}`; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const zoom_plugin = { |
|
|
|
|
|
|
|
zoom: { |
|
|
|
|
|
|
|
wheel: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
pinch: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mode: "x", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
pan: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
mode: "x", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
window.onload = create_charts; |
|
|
|
window.onload = create_charts; |
|
|
|
|
|
|
|
|
|
|
@ -108,7 +123,8 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
zoom: zoom_plugin, |
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -142,7 +158,8 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
zoom: zoom_plugin, |
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -190,7 +207,8 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
zoom: zoom_plugin, |
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -286,15 +304,16 @@ function toggle_combined_chart() { |
|
|
|
chart.classList.add("closed"); |
|
|
|
chart.classList.add("closed"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function toggle_leaderboard_chart() { |
|
|
|
function toggle_leaderboard_chart(event) { |
|
|
|
if (this.classList.contains("closed")) { |
|
|
|
if (this.classList.contains("closed")) { |
|
|
|
this.classList.remove("closed"); |
|
|
|
this.classList.remove("closed"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (event.target.nodeName === "CANVAS") return; |
|
|
|
this.classList.add("closed"); |
|
|
|
this.classList.add("closed"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
document.querySelectorAll("button.open-general-graph").forEach(element => element.addEventListener("click", toggle_combined_chart)); |
|
|
|
document.querySelectorAll("button.open-general-graph").forEach(element => element.addEventListener("click", toggle_combined_chart)); |
|
|
|
document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("click", toggle_leaderboard_chart)); |
|
|
|
document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("mousedown", toggle_leaderboard_chart)); |
|
|
|
|
|
|
|
|
|
|
|
async function update_leaderboard_entries() { |
|
|
|
async function update_leaderboard_entries() { |
|
|
|
this.disabled = true; |
|
|
|
this.disabled = true; |
|
|
@ -345,6 +364,7 @@ function format_time_minsec(date) { |
|
|
|
} |
|
|
|
} |
|
|
|
return min + trenner + nullausgleich + date.getSeconds() + format; |
|
|
|
return min + trenner + nullausgleich + date.getSeconds() + format; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const month_names = ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]; |
|
|
|
|
|
|
|
|
|
|
|
async function update_leaderboard_elements() { |
|
|
|
async function update_leaderboard_elements() { |
|
|
|
fetch(`./leaderboard_list.php`, { |
|
|
|
fetch(`./leaderboard_list.php`, { |
|
|
|