/
graph.html
252 lines (214 loc) · 10.9 KB
/
graph.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!doctype html>
<html lang="en">
<head>
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<!-- Material Design icon font -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>History</title>
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="images/android-desktop.png">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Material Design Lite">
<link rel="apple-touch-icon-precomposed" href="images/ios-desktop.png">
<!-- Tile icon for Win8 (144x144 + tile color) -->
<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<meta name="msapplication-TileColor" content="#3372DF">
<link rel="shortcut icon" href="images/favicon.png">
<!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
<!--
<link rel="canonical" href="http://www.example.com/">
-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.cyan-light_blue.min.css">
<link rel="stylesheet" href="styles.css">
<title>History</title>
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script type="text/javascript" src="canvasjs.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.7.3/firebase.js"></script>
<link rel="stylesheet" href="styles.css">
<style>
#view-source {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 40px;
margin-bottom: 40px;
z-index: 900;
}
</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.cyan-light_blue.min.css">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
<header class="demo-header mdl-layout__header mdl-color--grey-100 mdl-color-text--grey-600">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">History</span>
<ul class="mdl-menu mdl-js-menu mdl-js-ripple-effect mdl-menu--bottom-right" for="hdrbtn">
<li class="mdl-menu__item">About</li>
<li class="mdl-menu__item">Contact</li>
<li class="mdl-menu__item">Legal information</li>
</ul>
</div>
</header>
<div class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
<header class="demo-drawer-header">
<img src="Slice1.png" style="width:90%" style="margin":"50%">
<div class="demo-avatar-dropdown">
<span>epicshaunak@gmail.com</span>
<div class="mdl-layout-spacer"></div>
<button id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">arrow_drop_down</i>
<span class="visuallyhidden">Accounts</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="accbtn">
<li class="mdl-menu__item">epicshaunak@gmail.com</li>
<li class="mdl-menu__item"><i class="material-icons">add</i>Add another account...</li>
</ul>
</div>
</header>
<nav class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
<a class="mdl-navigation__link" href="index.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">home</i>Home</a>
<a class="mdl-navigation__link" href="graph.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">history</i>History</a>
<a class="mdl-navigation__link" href="settings.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">settings</i>Settings</a>
<a class="mdl-navigation__link" href="Roster.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">list</i>Roster</a>
<a class="mdl-navigation__link" href="connect.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">link</i>Connect</a>
<a class="mdl-navigation__link" href="about.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help</i>about</a>
<div class="mdl-layout-spacer"></div>
<a class="mdl-navigation__link" href=""><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help_outline</i><span class="visuallyhidden">Help</span></a>
</nav>
</div>
<main class="mdl-layout__content mdl-color--grey-100">
<div style="text-align: center; color:#abb8cc">
</main>
</div>
<body>
<div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
<div class="mdl-layout__header-row">
<div class="mdl-layout-spacer"></div>
</div>
</header>
<div class="demo-avatar-dropdown">
</header>
</div>
<main class="mdl-layout__content mdl-color--grey-100">
<script type="text/javascript">
var config = {
apiKey: "AIzaSyAr21BJp_Jruj-Z3OShfcl55ClbefqPdd4",
authDomain: "hshacks-4d484.firebaseapp.com",
databaseURL: "https://hshacks-4d484.firebaseio.com",
storageBucket: "hshacks-4d484.appspot.com",
messagingSenderId: "334564840194"
};
firebase.initializeApp(config);
var database = firebase.database();
var reference = database.ref();
/*
reference.on("value",function(snapshot){
addData(snapshot.val());
});
*/
function writeData(location, name, value) {
database.ref(location).update({
[name]: value,
});
}
function resetDatabase() {
database.ref().set(null);
}
reference.on("value", function(snapshot) {
addData(snapshot.val());
});
var chart;
function addData(value) {
//chart.options.title.text = "New DataPoint Added at the end";
chart.options.data[0].dataPoints.push({
y: parseInt(value)
});
chart.render();
console.log(value + " was added");
ajax();
}
function fixData(index, value) {
var length = chart.options.data[0].dataPoints.length;
//chart.options.title.text = "Last DataPoint Updated";
chart.options.data[0].dataPoints[length - 1].y = parseInt(index);
chart.render();
console.log(value + " was changed at " + index);
}
function resetChart() {
chart = new CanvasJS.Chart("chartContainer", {
title: {
text: "Adil Bukhari"
},
data: [{
type: "spline",
dataPoints: [{
}]
}]
});
chart.render();
}
window.onload = function() {
resetChart();
}
function ajax() {
$.ajax({
url: "https://smarttardy.herokuapp.com",
method: "GET",
success: function(data) {
addData(data*1000);
}
});
}
window.setTimeout(
function(){
$("#tardy1").html("<b>Yes</b>")
$("#tardy2").html("<b>No</b>")
$(".mdl-spinner").remove()
},
3000
)
</script>
<br>
<center><h1 style="text-align: center; color:#abb8cc">History</h1></center>
<center><h2 style="text-align: center; color:#abb8cc">Adil Bukhari</h2></center>
<center><div id="chartContainer" style="width:60%; height:280px"></div></center>
<br>
<br>
<center><h2 style="text-align: center; color:#abb8cc">Adnan Ahmed</h2></center>
<br>
<br>
<center><div id="chart2Container" style="width:60%; height:280px"></div></center>
<center>
</div>
</center>
</body>
<br>
<style>
main {
background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(dark.jpg) no-repeat black;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
</body>
</html>