-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
65 lines (59 loc) · 1.48 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--link to CSS-->
<link rel "stylesheet" href = "style.css">
<title>Employee salaries bar graph</title>
</head>
<body>
<div class="chartMenu">
<p>Employees salaries | Bar chart </p>
</div>
<div class="chartCard">
<div class="chartBox">
<canvas id="myChart"></canvas>
</div>
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script type="text/javascript" src="apps.js"></script>
<script>
let employeeFullName =[];
let employeeSalaryData =[];
async function drawChart(){
await apiData()
// setup
const data = {
labels: employeeFullName,
datasets: [{
label: 'Annual Salary',
data: employeeSalaryData,
backgroundColor: 'rgba(255, 26, 104, 0.2)',
borderColor: 'rgba(255, 26, 104, 1)',
borderWidth: 1
}]
};
// config
const config = {
type: 'bar',
data,
options: {
scales: {
y: {
beginAtZero: true
}
}
}
};
// render init block
const myChart = new Chart(
document.getElementById('myChart'),
config
);
// console.log(employeeFullName)
}
drawChart()
</script>
</body>
</html>