forked from Technigo/project-github-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchart2.js
More file actions
235 lines (226 loc) · 6.34 KB
/
chart2.js
File metadata and controls
235 lines (226 loc) · 6.34 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
//DOM-selector for sprint chart
const sprint = document.getElementById('sprintChart')
// Date Consts (In Epoch - Milliseconds)
const feb21 = 1645401600000
const feb28 = 1646006400000
const mar7 = 1646611200000
const mar14 = 1647216000000
const mar21 = 1647820800000
const mar28 = 1648425600000
const apr4 = 1649030400000
const apr11 = 1649635200000
const apr18 = 1650240000000
const apr25 = 1650844800000
const may2 = 1651449600000
const may9 = 1652054400000
const may16 = 1652659200000
const may23 = 1653264000000
const may30 = 1653868800000
const jun6 = 1654473600000
const jun13 = 1655078400000
const jun20 = 1655683200000
// Let declarations
let sprint1
let sprint2
let sprint3
let sprint4
let sprint5
let sprint6
let colors = []
let now = Date.now()
// Function for determining date & setting sprint data and colors on bar chart
const dataColors = () => {
// If statements for sprints
if (now > feb21 && now < feb28) {
sprint1 = 4;
sprint2 = 3;
sprint3 = 0;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > feb28 && now < mar7) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 0;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > mar7 && now < mar14) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 1;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > mar14 && now < mar21) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 2;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > mar21 && now < mar28) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 3;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > mar28 && now < apr4) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 0;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > apr4 && now < apr11) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 1;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > apr11 && now < apr18) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 2;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > apr18 && now < apr25) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 3;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC', '#DCD8DC']
} if (now > apr25 && now < may2) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 0;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC']
} if (now > may2 && now < may9) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 1;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC']
} if (now > may9 && now < may16) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 2;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC']
} if (now > may16 && now < may23) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 3;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC', '#DCD8DC']
} if (now > may23 && now < may30) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 4;
sprint6 = 0;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC']
} if (now > may30 && now < jun6) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 4;
sprint6 = 1;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC']
} if (now > jun6 && now < jun13) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 4;
sprint6 = 2;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC']
} if (now > jun13 && now < jun20) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 4;
sprint6 = 3;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#DCD8DC']
} else if (now > jun20) {
sprint1 = 4;
sprint2 = 4;
sprint3 = 4;
sprint4 = 4;
sprint5 = 4;
sprint6 = 4;
colors = ['#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f', '#2d2e2f']
}
}
//Chart function
const sprintProgress = () => {
// Run dataColors for determining sprint progress & bar colors
dataColors();
const data = {
labels: [
'Sprint 1',
'Sprint 2',
'Sprint 3',
'Sprint 4',
'Sprint 5',
'Sprint 6'
],
datasets: [{
data: [sprint1, sprint2, sprint3, sprint4, sprint5, sprint6],
backgroundColor: colors,
hoverOffset: 8,
hoverBorderColor: [
'#FFFFFF'
],
}]
};
const config = {
type: 'bar',
data: data,
options: {
scales: {
x: {
ticks: {
stepSize: 1,
}
}
},
indexAxis: 'y',
plugins: {
legend: {
display: false,
},
}
}
};
const sprintChart = new Chart(
sprint,
config,
);
}
sprintProgress();