-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·316 lines (280 loc) · 14.4 KB
/
index.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
<!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 navbar-right">
<li><a href="http://www.cl.cam.ac.uk/research/srg/netos/c-aware/joule/htmldoc/index.html"">HELP</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:iml1@cl.cam.ac.uk?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" ></label>
<input type="file" id="cfile" name="cfile" accept="application/json" multiple="false" style="display : none;"/>
</div>
<button type="submit" id="LoadConfig" class="btn btn-success" onclick="document.getElementById('cfile').click();" data-dismiss="modal" >Load a configuration</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="joule.ui.tree.reset()" title="Reset to initial selection"><span class="glyphicon glyphicon-refresh"></span></button>
<button class="btn btn-xs btn-default" onclick="joule.ui.tree.expand()" title="Expand all"><span class="glyphicon glyphicon-resize-full"></span></button>
<button class="btn btn-xs btn-default" onclick="joule.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="joule.ui.units(this)" class="active"><a href="#" class="noLink">Power (kW)</a></li>
<li role="unit" unit="carbon" onclick="joule.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="joule.ui.graph(this, 'line')" title="Create line chart">Line</button>
<button name="sankey" class="btn btn-sm btn-default" onclick="joule.ui.graph(this, 'sankey')" title="Create sankey diagram">Sankey</button>
<button name="treeMap" class="btn btn-sm btn-default" onclick="joule.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="joule.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="joule.ui.line.scaleChange('scale')" title="Limit Y axis scale to loaded data">Selection</button>
<button class="btn btn-sm btn-default" id="zoomButton" onclick="joule.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="joule.ui.line.toggleFilter()" id="filter" title="Smoothen the data using a gaussian filter">Smooth</button>
<button class="btn btn-sm btn-default active" onclick="joule.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="joule.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="joule.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="joule.ui.sankey.fastForward()" name="ff" title="Increase animation speed"><span class="glyphicon glyphicon-forward"></span></button>
<button class="btn btn-sm btn-default" onclick="joule.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="joule.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="joule.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="joule.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/lib/decycle.js"></script>
<script type="text/javascript" src="js/joule.utils.js"></script>
<script type="text/javascript" src="js/joule.JSONCache.js"></script>
<script type="text/javascript" src="js/joule.tree.js"></script>
<script type="text/javascript" src="js/joule.timeSeries.js"></script>
<script type="text/javascript" src="js/joule.data.js"></script>
<script type="text/javascript" src="js/joule.chart.js"></script>
<script type="text/javascript" src="js/joule.ui.js"></script>
<script type="text/javascript">
// Configuration file select handler
function handleFileSelect(evt) {
var f = evt.target.files[0]; // FileList object
var reader = new FileReader();
reader.readAsText(f);
// Closure to capture the file information.
reader.onload = (function() {
return function(e) {
if(evt.data._file === 'configFile')
config = JSON.parse(e.target.result).config;
Run(config);
}
})();
}
function Run (config){
console.log ("about to create tree data structure");
var tr = new tree(config.treeData);
joule = {
tree : tr,
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);
}
// Default Location
var joule = new Object();
var configFile = "";
var config;
var funcTree;
console.groupCollapsed("Joule starting routines");
var opts = utils.getUrlArgs();
console.log(opts);
if (opts.hasOwnProperty("config")) configFile = opts.config;
var cache = new JSONCache();
var ui = new JouleUIController();
$(document).ready(function() {
if (configFile == "") {
// Need to ask user for the config file (tree data must be in same file)
$('#cfile').on('change',{_file: 'configFile'}, handleFileSelect);
$('#setupModal').modal('show'); // modal will cause Run(config) if all well
}
else {
config = ui.catchError(ui, cache.getObject, [configFile, false]).responseJSON.config;
if (config.hasOwnProperty ("treeUrl")) {
config.treeData = ui.catchError(ui, cache.getObject, [config.treeUrl.value, false]).responseJSON;
}
Run (config);
}
});
</script>
</body>
</html>