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
34 lines (27 loc) · 979 Bytes
/
Copy pathchart.js
File metadata and controls
34 lines (27 loc) · 979 Bytes
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
//DOM-selector for the canvas
const ctx = document.getElementById('chart').getContext('2d')
// the function that draws the chart of finished/remaining projects.
//It gets the value from line 60 in script.js where doughnuCounter and technigoRepos.length
// is passing the filtered repos length to the chart here
const doughnutCounter = (projects) => {
const labels = [
'Finished projects',
'Remaining projects',
];
const data = {
labels: labels,
datasets: [{
//here is the calculation for remaining projects
data: [projects, 19-projects],
label: 'My finished projects',
backgroundColor: ['rgb(217, 96, 152)', 'rgb(50, 82, 136)'],
borderColor: 'rgb(38, 0, 27)',
}]
};
const config = {
type: 'doughnut',
data: data,
options: {}
};
const myChart = new Chart(document.getElementById('chart'),config);
}