-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcentrality_correlation.html
169 lines (166 loc) · 8.32 KB
/
centrality_correlation.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
<!DOCTYPE html>
<html>
<!-- Displays the correlation matrix of the selected centralities. -->
<head>
<title>Centrality Correlation</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="CSS/layout.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//npmcdn.com/[email protected]/dist/js/tether.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="JS/contentHandler.js"></script>
<script src="node_modules/js-base64/base64.js"></script>
<script src="JS/ServiceAPI/moduleHelper.js"></script>
<script src="JS/ServiceAPI/serviceAPI.js"></script>
<script src="JS/requestHandler.js"></script>
<script src="node_modules/tablesorter/dist/js/jquery.tablesorter.min.js"></script>
<script src="JS/centralityTableHandler.js"></script>
<script type="text/javascript">
/* The number of centrality maps that are shown */
var numberOfMaps = 0;
/* Counts the number of responses that have been received */
var responseCounter = 0;
/*
* Executed after page loading.
*/
$(document).ready(function() {
var mapIdsStr = localStorage.getItem("mapIds");
var mapIds = mapIdsStr.split("&mapIds=");
// The first entry of mapIds is empty
numberOfMaps = mapIds.length-1;
var graphId = localStorage.getItem("graphId");
/* Identifiers for meta information to be displayed */
var cells = ["CentralityMapId", "Name", "Graph", "Creation Method", "Execution Time"];
var index;
for(index = 1; index < numberOfMaps+1; index++) {
var mapId = mapIds[index];
/* Requests centrality map meta information */
sendRequest("get", "centrality/" + mapId + "/graphs/" + graphId + "?outputFormat=META_XML", "",
/* Response handler */
function(mapMetaXml) {
/*
* Init meta table
*/
appendCentralityMapRow($('#mapMetaTable'), mapMetaXml, cells);
responseCounter++;
afterResponse();
},
/* Error handler */
function(errorData) {
/*
* Centrality map request failed
*/
showConnectionErrorMessage("Centrality map was not received.", errorData);
}, "text");
}
displayMatrix(localStorage.getItem("correlationMatrixXml"));
$("#precisionCheckbox").change(function() {
$("#matrixTable thead").html("");
$("#matrixTable tbody").html("");
displayMatrix(localStorage.getItem("correlationMatrixXml"));
});
});
function afterResponse() {
if(responseCounter == numberOfMaps) {
try {
$("#mapMetaTable").tablesorter({sortList: [[1,0],[0,0]],
headers: {}});
} catch(err) { /* table empty */ }
/*
* Register event handlers
*/
registerCentralityTable();
}
}
function displayMatrix(matrixXml) {
var header = "<th/>";
$(matrixXml).find("Row").each(function() {
header += "<th>" + $(this).attr("CentralityMapId") + "</th>";
});
$("#matrixTable").children("tbody").append(header);
if(precisionCheckbox.checked) {
$(matrixXml).find("Row").each(function() {
var row = "<tr>"
row += "<th>" + $(this).attr("CentralityMapId") + "</th>";
var cellXml = $(this).find("Cell").each(function() {
var entry = $(this).text();
row += "<td>" + entry + "</td>";
});
row += "</tr>"
$("#matrixTable").children("tbody").append(row);
});
}
else {
$(matrixXml).find("Row").each(function() {
var row = "<tr>"
row += "<th>" + $(this).attr("CentralityMapId") + "</th>";
var cellXml = $(this).find("Cell").each(function() {
var entry = parseFloat($(this).text());
row += "<td>" + entry.toFixed(4) + "</td>";
});
row += "</tr>"
$("#matrixTable").children("tbody").append(row);
});
}
}
</script>
</head>
<body>
<div id="wrapper">
<div id="contentWrapper">
<div id="content">
<!-- Displays error messages -->
<div id="errorMessageWrapper">
<div id="errorMessage"></div>
</div>
<!-- Centrality meta information table -->
<div class="tableWrapper table-responsive">
<table id="mapMetaTable" class="table table-striped">
<thead>
<tr>
<th title="CentralityMapId" class="sortable">
Id
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th class="hidden" title="GraphId"></th>
<th width="300" title="Name" class="sortable">
Name
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="300" title="Graph Name" class="sortable">
Graph
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="300" title="Creation Method" class="sortable">
Creation Method
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="200" title="Execution Time" class="sortable">
Execution Time (ms)
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id="tableControls">
<div class="checkbox">
<label><input id="precisionCheckbox" type="checkbox" value="">High Precision</label>
</div>
</div>
<h5 class="sub-header">Correlation Matrix</h5>
<div class="table-responsive">
<table id="matrixTable" class="table">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>