forked from jonbloom/traffic-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noise.php
85 lines (74 loc) · 2.43 KB
/
noise.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
76
77
78
79
80
81
82
83
84
85
<!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">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Library Traffic Data Dashboard</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<?php include 'nav.php';?>
<div class="container" id="main">
<form onsubmit="return false;">
<h2>Average Noise By Area <small>1 = Loud, 5 = Silent</small></h2>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div id="chart"></div>
</div>
</div>
<?php
include 'filters.php';
?>
</form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/scripts.js"></script>
<script type="text/javascript">
var data;
function drawChart(refresh) {
if (refresh){
var xhr = new XMLHttpRequest();
xhr.open('GET','php/avgNoise.php?' + jQuery('form').serialize(),false);
xhr.send();
data = new google.visualization.DataTable();
data.addColumn('string', 'Area');
data.addColumn('number', 'Level', {role: 'annotationtext'});
data.addColumn({type: 'string', role: 'tooltip', p:{html: true}});
data.addRows(JSON.parse(xhr.responseText));
}
var options = {
height: 500,
vAxis:{
viewWindow: {
min: 0,
max: 5
},
title: 'Noise Level'
},
hAxis:{
title: 'Area'
},
tooltip:{
isHtml: true
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart'));
chart.draw(data, options);
return false;
}
</script>
</body>
</html>