-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisualization_admin.php
61 lines (51 loc) · 1.56 KB
/
Visualization_admin.php
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
<?php include 'header.php'?>
<div class="scrollmenu">
<a href="index_admin.php">Home</a>
<a class="active" href="Visualization_admin.php">Visualization a, b, c</a>
<a href="Visualization_admin_1.php">Visualization d</a>
<a href="logout.php">Logout</a>
</div>
<title>Visualization admin</title>
<div class = "container">
<canvas id = "lineChart" width="400" height="200" aria-label="Hello ARIA World" role="img"></canvas>
</div>
<script>
var data = $.ajax({
url: "data_backend.php",
type: "POST",
dataType: "json",
success: function(data) {
console.log(data);
}
});
data.done(success)
function success(responseText) {
let chart_data = [];
chart_data.push(parseInt(responseText[0].user_visits), parseInt(responseText[1].covid_case), responseText[2].positive);
console.log(chart_data);
const CHART1 = document.getElementById("lineChart").getContext('2d');
let lineChart = new Chart(CHART1, {
type: 'bar',
data: {
labels: ["No. of Users visits","No. of Covid cases","No. of positive visits"],
datasets: [{
fill: false,
data: chart_data,
backgroundColor: ['yellow','red','green'],
borderWidth: 1,
borderColor: '#777',
hoverBorderWidth: 3,
hoverBorderColor: '#000'
}
]
},
options: {
plugins: {
legend: {
display: false
}
}
}
});
}
</script>