-
Notifications
You must be signed in to change notification settings - Fork 0
/
stadium-cotd-graph.js
117 lines (110 loc) · 3.23 KB
/
stadium-cotd-graph.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Chart.defaults.color = "white";
Chart.defaults.backgroundColor = "white";
var plugin = {
id: 'bgColour',
beforeDraw: (chart, args, options) => {
const {ctx} = chart;
ctx.save();
ctx.globalCompositeOperation = 'destination-over';
ctx.fillStyle = options.color;
ctx.fillRect(0, 0, chart.width, chart.height);
ctx.restore();
}
};
var dirtData = [{x:1, y:41}];
var fsData = [{x:2, y:37}, {x:6, y:47}, {x:8, y:27}];
var bobData = [{x:3, y:45}];
var techData = [{x:4, y:41}];
var multiData = [{x:5, y:45}];
var reactorData = [{x: 7, y:40}];
const cotd = document.getElementById("cotd-stadium");
new Chart(cotd, {
type: "scatter",
data: {
datasets: [{
label: 'dirt',
data: dirtData,
pointRadius: 7,
backgroundColor: 'rgb(181, 114, 72)'
}, {
label: "fullspeed",
data: fsData,
pointRadius: 7,
backgroundColor: 'rgb(237, 83, 83)'
}, {
label: "bobsleigh",
data: bobData,
pointRadius: 7,
backgroundColor: 'rgb(255, 255, 255)'
}, {
label: "tech",
data: techData,
pointRadius: 7,
backgroundColor: 'rgb(150, 150, 150)'
}, {
label: "multi-surface",
data: multiData,
pointRadius: 7,
backgroundColor: 'rgb(255, 165, 0)'
}, {
label: "reactor",
data: reactorData,
pointRadius: 7,
backgroundColor: 'rgb(82, 93, 255)'
}]},
options: {
plugins: {
title: {
display: true,
text: "Stadium Car Cup of the Day",
font: {
size: 40
}
},
bgColour: {
color: 'rgb(0,0,0,0.5)',
},
legend: {
labels: {
font: {
size: 20,
}
},
ticks: {
font: {
size: 20,
}
}
},
},
scales: {
x: {
grid: {
color: "white"
},
ticks: {
color: "white",
font: {
size: 15,
},
stepSize: 1
}
},
y: {
grid: {
color: "white"
},
ticks: {
color: "white",
font: {
size: 15,
},
stepSize: 1,
beginAtZero: true,
},
reverse: true
},
}
},
plugins: [plugin],
});