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
56 lines (49 loc) · 1.6 KB
/
chart.js
File metadata and controls
56 lines (49 loc) · 1.6 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
//DOM-selector for the canvas 👇
const chart = document.getElementById('chart').getContext('2d')
Chart.defaults.font.family = 'Roboto'
Chart.defaults.font.size = 23
Chart.defaults.color = 'white'
progressChart = (projectsDone) => {
const config = {
type: 'doughnut',
data: {
datasets: [{
label: '',
backgroundColor: ['rgb(198, 228, 207)', 'rgb(111, 167, 132)'],
borderColor: 'rgb(22, 19, 21)',
hoverOffset: 8,
data: [projectsDone, 19 - projectsDone]
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: [
'done',
'todo',
]
},
options: {
plugins: {
responsive: true,
legend: {
display: true,
position:'bottom', //change to chartArea if bar chart
labels: {
fontColor: '#FFF',
fontFamily: 'Roboto',
boxWidth: 10,
boxHeight: 10,
}
},
title: {
display: true,
text: 'BOOT CAMP PROGRESS',
fontSize: 40,
position: 'top',
color: '#FFF',
fontFamily: 'Roboto',
weight: 'bold',
},
}
}
}
const myChart = new Chart(chart, config);
}