aboutsummaryrefslogtreecommitdiff
path: root/static/chess-charts.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/chess-charts.js')
-rw-r--r--static/chess-charts.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/static/chess-charts.js b/static/chess-charts.js
new file mode 100644
index 0000000..2932b2a
--- /dev/null
+++ b/static/chess-charts.js
@@ -0,0 +1,46 @@
+const chessData = JSON.parse(document.getElementById("chessData").textContent);
+const bulletData = chessData[0];
+const blitzData = chessData[1];
+const rapidData = chessData[2];
+
+const rapidCtx = document.getElementById("rapidChart").getContext("2d");
+const rapidChart = new Chart(rapidCtx, {
+ type: "line",
+ data: {
+ datasets: [
+ {
+ borderColor: "#3273dc",
+ label: "rapid",
+ data: rapidData.data,
+ },
+ ],
+ },
+});
+
+const blitzCtx = document.getElementById("blitzChart").getContext("2d");
+const blitzChart = new Chart(blitzCtx, {
+ type: "line",
+ data: {
+ datasets: [
+ {
+ borderColor: "#EDAE49",
+ label: "blitz",
+ data: blitzData.data,
+ },
+ ],
+ },
+});
+
+const bulletCtx = document.getElementById("bulletChart").getContext("2d");
+const bulletChart = new Chart(bulletCtx, {
+ type: "line",
+ data: {
+ datasets: [
+ {
+ borderColor: "#D1495B",
+ label: "bullet",
+ data: bulletData.data,
+ },
+ ],
+ },
+});