aboutsummaryrefslogtreecommitdiff
path: root/static/chess-charts.js
blob: 2932b2afc218f0325dc458c32025fc5c2cd359f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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,
      },
    ],
  },
});