forked from Technigo/project-github-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchart.js
More file actions
73 lines (64 loc) · 1.95 KB
/
chart.js
File metadata and controls
73 lines (64 loc) · 1.95 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
//DOM-selector for the canvas 👇
const ctx = document.getElementById('chart').getContext('2d')
// Global options
Chart.defaults.font.family = 'Manrope, sans-serif';
Chart.defaults.font.size = 25;
// Function for creating the chart
const drawChart = (doneProjects) => {
//"Draw" the chart here 👇
const config = {
type: 'doughnut',
data: {
labels: ['Projects done', 'Projects left to do'],
datasets: [{
label: 'Technigo Bootcamp 2022',
data: [
doneProjects,
19 - doneProjects,
],
backgroundColor: [
'#D1ADCC',
'#F6E9D7',
],
borderWidth: 1,
borderColor: '#F6E9D7',
hoverBorderWidth: 3,
hoverBorderColor: '#D1ADCC',
}],
},
options: {
responsive: true,
plugins: {
legend: {
display: true,
position: 'bottom',
labels: {
boxWidth: 20,
color: '',
color: '#5F2C3E',
padding: 30,
maxHeight: 30,
},
},
title: {
display: true,
text: 'Bootcamp Progress',
color: '#5F2C3E',
font: {
size: 32,
},
padding: {
top: 0,
right: 0,
left: 0,
bottom: 30,
},
},
},
// tooltips: {
// enabled: false,
// },
}
}
const myChart = new Chart(document.getElementById('chart'), config)
}