-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlineChartWeekly.php
More file actions
59 lines (52 loc) · 1.82 KB
/
lineChartWeekly.php
File metadata and controls
59 lines (52 loc) · 1.82 KB
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
<?php
error_reporting(0);
include('session.php');
include('redirectGraphData.php');
if(!isset($_SESSION['login_user'])){
header("location: index.php"); // Redirecting To Home Page
}
$servername = "localhost";
$username = "p_f21_16";
$password = "e3m6rq";
$dbname = "p_f21_16_db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM WeeklyReportData";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
$data = $row['PeopleEntered'];
}
?>
<html>
<head>
<button id="barChartButt"><a href="graphWeeklyReport.php">View Bar Chart</a></button>
<button id="gaugeChartButt"><a href="gaugeChartWeekly.php">View Gauge Chart</a></button>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Day Of The Week', 'People Entered'],
<?php
$sql = "SELECT * FROM WeeklyReportData";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
echo "['".$row['DayOfWeek']."',".$row['PeopleEntered']."],";
}
?>
]);
var options = {
title: 'Weekly Libary People Count',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>