-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindexon2.html
executable file
·370 lines (305 loc) · 15.7 KB
/
indexon2.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="description" content="">
<meta name="author" content="Chris Elsmore and Ian Leslie">
<title>Joule - An Energy Data Visualisation Tool from the C-Aware Project</title>
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="css/index.css" media="screen" charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="css/slick.grid.css" media="screen" charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="css/slick-default-theme.css" media="screen" charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" media="screen" charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="css/datetimepicker.css" media="screen" charset="utf-8"/>
<script type="text/javascript" src="js/lib/spin.js"></script>
<link rel="shortcut icon" href="images/favicon.ico?v=2">
<!-- <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-->
</head>
<body>
<!--[if IE]>
<div id="IEAlert">
<p class="alert">This tool does not support Internet Explorer. However you can use the tool if you install Google Chrome Frame within Internet Explorer. For more information: <a href="http://www.google.com/chromeframe">http://www.google.com/chromeframe</a>.</p>
<p class="alert">Alternatively you may use another broswer such as <a href="http://www.google.com/chrome/">Chrome</a>, <a href="http://www.mozilla.com/">Firefox</a> or <a href="http://www.apple.com/safari/">Safari</a>.</p>
</div>
<![endif]-->
<header>
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<a class="navbar-brand" href="/">Joule @ CL</a>
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Deployments<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="active" ><a href="#WGB">William Gates Bld</a></li>
<li><a href="#SE18">SE18 Server Room</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#about">About</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Feedback<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="mailto:[email protected]?subject=Joule Feedback">Email</a></li>
<li><a href="https://github.com/caware/c-vis/issues" target="_blank">GitHub Bug Report</a></li>
</ul>
</li>
<li><a href="http://www.cl.cam.ac.uk/research/srg/netos/c-aware/index.html" target="_blank">C-Aware</a></li>
</ul>
</div>
</div>
</header>
<div class="modal fade" id="setupModal" tabindex="-1" role="dialog" aria-labelledby="configModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="configModalLabel">Visualisation Configuration</h4>
</div>
<div class="modal-body">
<form action="" method="post" target="_self">
<div class="form-group">
<label for="ConfigFile" class="control-label" title="Upload a config file.">Configuration File:</label>
<input type="file" id="cfile" name="cfile" />
</div>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<button type="submit" id="FinishSetup" class="btn btn-success" data-dismiss="modal" >Submit</button>
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div id="content">
<div id="alert-bar">
<noscript>
<div class="alert alert-error">
<p><strong>Javascript Error!</strong> Your browser either does not support Javascript or it is not enabled. Please enable JavaScript, or update your browser (Joule works in recent versions of <a href="http://www.google.com/chrome/"><strong>Chrome</strong></a>, <a href="http://www.mozilla.com/"><strong>Firefox</strong></a> or <a href="http://www.apple.com/safari/"><strong>Safari</strong></a>).</p>
</div>
</noscript>
</div>
<div id="visContainer">
<div id="treeContainer">
<div id="treeTitle">
<h2>Selection tree</h2>
<button class="btn btn-xs btn-default" onclick="cvis.ui.tree.reset()" title="Reset to initial selection"><span class="glyphicon glyphicon-refresh"></span></button>
<button class="btn btn-xs btn-default" onclick="cvis.ui.tree.expand()" title="Expand all"><span class="glyphicon glyphicon-resize-full"></span></button>
<button class="btn btn-xs btn-default" onclick="cvis.ui.tree.collapse()" title="Collapse all"><span class="glyphicon glyphicon-resize-small"></span></button>
</div>
<div id="tree"></div>
</div>
<div id="chartContainer">
<div id="chartHeader">
<div class="btn-group">
<button class="btn btn-lg btn-default btn-units">Power (kW)</button>
<button type="button" class="btn btn-lg btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li role="unit" unit="power" onclick="cvis.ui.units(this)" class="active"><a href="#" class="noLink">Power (kW)</a></li>
<li role="unit" unit="carbon" onclick="cvis.ui.units(this)"><a href="#" class="noLink">CO<sub>2</sub> (g/s)</a></li>
</ul>
</div>
<div class="btn-group" style="float:right;">
<button name="line" class="btn btn-sm btn-default" onclick="cvis.ui.graph(this, 'line')" title="Create line chart">Line</button>
<button name="sankey" class="btn btn-sm btn-default" onclick="cvis.ui.graph(this, 'sankey')" title="Create sankey diagram">Sankey</button>
<button name="treeMap" class="btn btn-sm btn-default" onclick="cvis.ui.graph(this, 'treeMap')" title="Create tree map">Tree map</button>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 0%"></div>
<div class="progress-bar progress-bar-warning" style="width: 0%"></div>
<div class="progress-bar progress-bar-danger" style="width: 0%"></div>
</div>
</div>
<div id="chartBody"><div id="loading"></div></div>
<div id="chartControls">
<div class="btn-toolbar line">
<div class="btn-group" style="float: left;">
<button class="btn btn-sm btn-default" id="scaleAllButton" onclick="cvis.ui.line.scaleChange('all')" title="Limit Y axis scale to all data">All Data</button>
<button class="btn btn-sm btn-default active" id="scaleSelectionButton" onclick="cvis.ui.line.scaleChange('scale')" title="Limit Y axis scale to loaded data">Selection</button>
<button class="btn btn-sm btn-default" id="zoomButton" onclick="cvis.ui.line.scaleChange('zoom')" title="Limit Y axis scale to selected data">Zoom Selection</button>
</div>
<div class="btn-group">
<form class="form-inline" role="form">
Start:
<div class="form-group">
<input name="startDate" type="text" class="form-control date input-sm" placeholder="Start date" title="Set a starting date for the context">
</div>
End:
<div class="form-group">
<input name="endDate" type="text" class="form-control date input-sm" placeholder="End date" title="Set an ending date for the context">
</div>
</form>
</div>
<div class="btn-group">
<button class="btn btn-sm btn-default" onclick="cvis.ui.line.toggleFilter()" id="filter" title="Smoothen the data using a gaussian filter">Smooth</button>
<button class="btn btn-sm btn-default active" onclick="cvis.ui.line.toggleAreas()" id="areas" title="Toggle area gradients beneath the plot lines">Area gradient</button>
</div>
</div>
<div class="btn-toolbar sankey">
<form class="form-inline" role="form">
<button class="btn btn-sm btn-default" onclick="cvis.ui.sankey.stepDown()" name="stepDown" title="Move back by one frame"><span class="glyphicon glyphicon-chevron-left"></span></button>
<button class="btn btn-sm btn-default" onclick="cvis.ui.sankey.play()" name="play" title="Animate the data from start to end date"><span class="glyphicon glyphicon-play"></span></button>
<button class="btn btn-sm btn-default" onclick="cvis.ui.sankey.fastForward()" name="ff" title="Increase animation speed"><span class="glyphicon glyphicon-forward"></span></button>
<button class="btn btn-sm btn-default" onclick="cvis.ui.sankey.stepUp()" name="stepUp" title="Move forward by one frame"><span class="glyphicon glyphicon-chevron-right"></span></button>
<div class="form-group">
<select class="form-control input-sm" name="interval" onchange="cvis.ui.sankey.intervalChange()" title="Set the interval between consecutive frames">
<option value="hourly">Hourly</option>
<option value="daily">Daily</option>
<option value="weekly">Weekly</option>
<option value="monthly">Monthly</option>
</select>
</div>
Start:
<div class="form-group">
<input name="startDate" type="text" class="form-control date input-sm" placeholder="Start date" title="Set a starting date for the data">
</div>
End:
<div class="form-group">
<input name="endDate" type="text" class="form-control date input-sm" placeholder="End date" title="Set an ending date for the data">
</div>
<button class="btn btn-sm btn-default" onclick="cvis.ui.sankey.levelUp()" name="levelUp" title="Navigate up one level">Level <span class="glyphicon glyphicon-arrow-up"></button>
Max depth:
<div class="form-group">
<input name="maxDepth" type="number" onchange="cvis.ui.sankey.changeDepth(this)" class="form-control input-sm" placeholder="Max depth" min="1" max="5" value="5" title="Set the maximum depth of the diagram">
</div>
</form>
</div>
<div class="btn-toolbar treeMap">
<form class="form-inline" role="form">
Average data from:
<div class="form-group">
<input name="startDate" type="text" class="form-control date input-sm" placeholder="Start date" title="Set a starting date for the data">
</div>
to:
<div class="form-group">
<input name="endDate" type="text" class="form-control date input-sm" placeholder="End date" title="Set an ending date for the data">
</div>
</form>
</div>
</div>
<div id="chartInfo">
<div id="data-table"></div>
</div>
</div>
</div>
</div>
<footer>
<p>Joule v4.0 | University Of Cambridge Computer Lab: <a href="http://www.cl.cam.ac.uk/research/srg/netos/c-aware/index.html" target="_blank">C-AWARE Project</a></p>
</footer>
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="js/lib/jquery.event.drag-2.2.js"></script>
<script type="text/javascript" src="js/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="js/lib/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="js/lib/d3.v3.min.js"></script>
<script type="text/javascript" src="js/lib/d3.sankey.js"></script>
<script type="text/javascript" src="js/lib/underscore-min.js"></script>
<script type="text/javascript" src="js/lib/date-en-GB.js"></script>
<script type="text/javascript" src="js/lib/slick.core.js"></script>
<script type="text/javascript" src="js/lib/slick.grid.js"></script>
<script type="text/javascript" src="js/lib/slick.editors.js"></script>
<script type="text/javascript" src="js/lib/slick.formatters.js"></script>
<script type="text/javascript" src="js/lib/slick.dataview.js"></script>
<script type="text/javascript" src="js/lib/spin.min.js"></script>
<script type="text/javascript" src="js/cvis.utils.js"></script>
<script type="text/javascript" src="js/cvis.JSONCache.js"></script>
<script type="text/javascript" src="js/cvis.tree.js"></script>
<script type="text/javascript" src="js/cvis.timeSeries.js"></script>
<script type="text/javascript" src="js/cvis.data.js"></script>
<script type="text/javascript" src="js/cvis.chart.js"></script>
<script type="text/javascript" src="js/cvis.ui.js"></script>
<script type="text/javascript">
$('#setupModal').modal('show');
var configFile, treeFile;
//File Select Handler
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.
if (!f.type.match('application.json')) {
continue;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
console.log(e.target.result);
console.log('something');
if(evt.data._file === 'configFile')
configFile = e.target.result;
}
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
//Assigning handlers
$('#cfile').on('change',{_file: 'configFile'}, handleFileSelect);
$('#FinishSetup').click(function(){
window.localStorage.setItem('configFile', configFile);
});
</script>
<script type="text/javascript">
var GLOBAL_OBJECT = this;
var tree = tree; //Reassigning function as it falls out of scope in 'FinishSetup' click event handler
var cvis, opts, cache, ui, config; //Making variables global
$(document).ready(function(){
$('#FinishSetup').click(function (){
var configFile = window.localStorage.getItem('configFile');
window.localStorage.removeItem('configFile');
if(configFile === 'undefined' || configFile === null) //resets the modal
$('#setupModal').modal('hide');
// Default Location
cvis = new Object();
console.groupCollapsed("Joule starting routines");
opts = utils.getUrlArgs();
console.log(opts);
if (opts.hasOwnProperty("config")) configFile = opts.config;
cache = new JSONCache();
ui = new JouleUIController();
console.log("Attempting to read " + configFile);
config = ui.catchError(ui, cache.getObject, [configFile, false]).responseJSON.config;
console.log(config);
console.log("Read Configuration");
var funcTree = ui.catchError(ui, cache.getObject, [config.treeUrl.value, false]).responseJSON;
console.log("Loaded tree");
console.log(funcTree);
var tree = new GLOBAL_OBJECT.tree(funcTree);
cvis = {
tree: tree,
data: new data(tree.plotLineDesc),
chart: new chart({
w: 750,
h1: 400,
h2: 50,
spacing: 30,
margin_top: 30,
margin_right: 20,
margin_bottom: 20,
margin_left: 30,
type: typeof config.defaultChart !== 'undefined' ? config.defaultChart.value : "line"
}),
config: config,
ui: ui,
utils: utils,
cache: cache
};
delete config;
delete ui;
console.log("Built tree");
console.groupEnd();
ui.jouleFinishedLoading(ui, 'line');
ui.jouleStopLoading(ui);
});
});
</script>
</body>
</html>