-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
81 lines (77 loc) · 2.95 KB
/
index.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<button class="stats-btn">Display Bar Chart</button>
<div class="popup-container">
<h3>players longest career</h3>
<div class="popup-content">
<div class="chart-container">
<canvas id="myChart" width="400" height="400"></canvas>
</div>
<div class="popup-details">
these are the players with the top longest career life.
</div>
</div>
<div class="close-button">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min.js"></script>
<script>
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Player_name1', 'Player_name2', 'Player_name3', 'Player_name4', 'Player_name5'],
datasets: [{
label: '# longth of career years',
data: [25, 22, 19, 16, 15],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
],
borderWidth: 1
}]
},
options: {
scales: {
y: {
min: 10,
max: 25,
}
}
}
});
</script>
<script>
const popupContainer = document.querySelector(".popup-container");
const activeBtn = document.querySelector(".stats-btn");
const closeBtn = document.querySelector(".popup-container .close-button");
activeBtn.addEventListener("click", () => {
popupContainer.classList.add("active");
})
closeBtn.addEventListener("click", () => {
popupContainer.classList.remove("active");
})
</script>
</body>
</html>