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
36 lines (32 loc) · 802 Bytes
/
chart.js
File metadata and controls
36 lines (32 loc) · 802 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
35
36
// font family & color for the chart
Chart.defaults.font.family = "Roboto, sans-serif";
Chart.defaults.color = "#333";
// DOM-selector for the chart
const ctx = document.getElementById("chart").getContext("2d");
// function to draw the chart, with the "completed projects" as an argument
const renderChart = (projects) => {
const data = {
labels: ["completed projects", "not yet completed projects"],
datasets: [
{
data: [projects, 19 - projects],
backgroundColor: ["#2FC5EE", "#FF1E00"],
borderColor: "#FEFBF3",
hoverOffset: 8,
},
],
};
const config = {
type: "doughnut",
data: data,
options: {
font: {
size: 10,
},
layout: {
padding: 15,
},
},
};
new Chart(ctx, config);
};