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
24 lines (21 loc) · 643 Bytes
/
Copy pathchart.js
File metadata and controls
24 lines (21 loc) · 643 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
//DOM-selector for the canvas 👇
const ctx = document.getElementById("chart").getContext("2d");
const drawProgressChart = (repos) => {
const completedProjects = repos.length;
const totalProjects = 20;
const labels = repos.map((repo) => repo.name);
const data = repos.map((repo) => repo.size);
const chart = new Chart(ctx, {
type: "doughnut",
data: {
labels: ["Completed Projects", "Projects left to build"],
datasets: [
{
data: [completedProjects, totalProjects - completedProjects],
backgroundColor: ["blue", "red"],
hoverOffset: 4,
},
],
},
});
};