-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
79 lines (63 loc) · 1.72 KB
/
dashboard.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php include('header.php'); ?>
<?php include('left_sidebar.php'); ?>
<div class="container-fluid">
<div class="row">
<h1 class="text-center">Dashboard</h1>
<div><h1>
<?php
if($core->is_loggedIn()){
echo 'Hello ' . $_SESSION['name'] ;
}
?></h1>
</div>
<div>
<!-- HTML -->
<div id="chartdiv"></div>
<!-- Styles -->
<style>
#chartdiv {
width: 100%;
height: 500px;
}
</style>
<?php
$totalUserCount = $core->userCount();
$employee = $totalUserCount['totalEmpl'] ;
$userno = $totalUserCount['totalUser'] ;
?>
<!-- Resources -->
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<!-- Chart code -->
<script>
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.PieChart);
// Add data
chart.data = [ {
"country": "Employee",
"litres": <?= $employee ;?>
}, {
"country": "User",
"litres": <?= $userno ;?>
}];
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "litres";
pieSeries.dataFields.category = "country";
pieSeries.slices.template.stroke = am4core.color("#fff");
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
// This creates initial animation
pieSeries.hiddenState.properties.opacity = 1;
pieSeries.hiddenState.properties.endAngle = -90;
pieSeries.hiddenState.properties.startAngle = -90;
</script>
</div>
</div>
</div>
</div>
<?php include('footer.php'); ?>