Skip to content

Commit 0fa6fdf

Browse files
committed
added chart, gitignore and token
1 parent 9211732 commit 0fa6fdf

5 files changed

Lines changed: 56 additions & 2 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
4+
# other
5+
code/token.js
6+

code/chart.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,34 @@
22
const ctx = document.getElementById('chart').getContext('2d')
33

44
//"Draw" the chart here 👇
5+
6+
const labels = [
7+
'January',
8+
'February',
9+
'March',
10+
'April',
11+
'May',
12+
'June',
13+
];
14+
15+
const data = {
16+
labels: labels,
17+
datasets: [{
18+
label: 'My First dataset',
19+
backgroundColor: 'rgb(255, 99, 132)',
20+
borderColor: 'rgb(255, 99, 132)',
21+
data: [0, 10, 5, 2, 20, 30, 45],
22+
}]
23+
};
24+
25+
const config = {
26+
type: 'doughnut',
27+
data: data,
28+
options: {}
29+
};
30+
31+
32+
const myChart = new Chart(
33+
document.getElementById('chart'),
34+
config
35+
);

code/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<title>Project GitHub Tracker</title>
99
<link rel="stylesheet" href="./style.css" />
10+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
1011
</head>
1112

1213
<body>
@@ -19,8 +20,10 @@
1920
<!-- This will be used to draw the chart 👇 -->
2021
<canvas id="chart"></canvas>
2122

22-
<script src="./script.js"></script>
23+
24+
<script src="./token.js"></script>
2325
<script src="./chart.js"></script>
26+
<script src="./script.js"></script>
2427
</body>
2528

2629
</html>

code/script.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
//Username
22
const username = 'rijad90'
33

4+
5+
const API_TOKEN = TOKEN || process.env.API_KEY;
6+
7+
8+
9+
//authenticated request
10+
const options = {
11+
method: 'GET', // POST, PATCH, DELETE
12+
headers: {
13+
Authorization: `token ${API_TOKEN}` //token
14+
}
15+
}
16+
17+
418
//API URL
519
const GITHUB_USER_API = `https://api.github.com/users/${username}`
620
const GITHUB_REPOS_API = `https://api.github.com/users/${username}/repos`

code/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ p {
1919
.pic {
2020
border-radius: 50%;
2121
max-width: 30%;
22-
}
22+
}

0 commit comments

Comments
 (0)