-
Notifications
You must be signed in to change notification settings - Fork 3
/
query_header.html
168 lines (147 loc) · 5.11 KB
/
query_header.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
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Stalker</title>
<link rel = "shortcut icon" href = "{{ url_for('static', filename = 'favicon.ico')}}">
<link href = "/static/bootstrap.min.css" rel = "stylesheet">
<link href = "/static/jumbotron-narrow.css" rel = "stylesheet">
<script type = "text/javascript" src = "/static/utility.js"></script>
<script type = "text/javascript" src = "/static/d3.v4.min.js"></script>
<style>
#loading {
width: 35px;
height: 35px;
display: none;
cursor: wait;
}
.links line {
stroke: #09D7F7;
stroke-opacity: 0.6;
}
.nodes circle {
stroke: #000;
stroke-width: 1.5px;
}
text {
font-family: sans-serif;
font-size: 10px;
}
</style>
</head>
<body>
<div id="loading">
<img src="./static/loadingimage.gif">
</div>
<div class = "container" id = "container">
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class = "alert alert-warning alert-dissmissible" role = "alert">
{{message}}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class = "header">
<nav>
<ul class = "nav nav-pills pull-right">
<li role = "presentation"><a href="home">Home</a></li>
<li role = "presentation" class = "active"><a href = "#">Query</a></li>
<li role = "presentation"><a href ="aboutus">About Us</a></li>
</ul>
</nav>
<h1 class = "text-muted">
<a href = "home">Stalker</a>
</h1>
</div>
<div class = "jumbotron">
<div class = "row marketing">
<h2>Query</h2>
<form class = "form-inline" action = {{url_for('query')}} method = 'post'>
<div class = "form-group">
<input type = "text" class = "form-control" name = "organisation" id = "organisation" placeholder = "Organisation" autofocus>
<input type = "text" class = "form-control" name = "email_address" id = "email_address" placeholder = "E-Mail Address">
</div>
<div align="center">
{{ recaptcha }}
</div>
<input type = "submit" class = "btn-primary" onClick="loading();alert_query_will_be_submitted()">
</form>
</div>
</div>
<style type="text/css">
table {
border-collapse: separate;
border-spacing: 50px 0;
}
</style>
<div style="margin-bottom:50px;width:100%;height:100% ;-webkit-box-shadow: 10px 10px 122px 0px rgba(0,0,0,0.75);-moz-box-shadow: 10px 10px 122px 0px rgba(0,0,0,0.75);box-shadow: 10px 10px 122px 0px rgba(0,0,0,0.75);">
<svg width="600" height="700" style="display: block; margin: auto;" ></svg>
</div>
<script>
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");
var color = d3.scaleOrdinal(d3.schemeCategory20);
var simulation = d3.forceSimulation()
.force("link", d3.forceLink().id(function(d) { return d.id; }).distance(200))
.force("charge", d3.forceManyBody())
.force("center", d3.forceCenter(width / 2, height / 2));
d3.json("/static/{{ organisation }}", function(error, graph) {
if (error) throw error;
var link = svg.append("g")
.attr("class", "links")
.selectAll("line")
.data(graph.links)
.enter().append("line")
.attr("stroke-width", function(d) { return 1.6; });
var node = svg.append("g")
.attr("class", "nodes")
.selectAll("g")
.data(graph.nodes)
.enter().append("g")
var circles = node.append("circle")
.attr("r", 5)
.attr("fill", function(d) { return color(d.group); })
.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended));
var lables = node.append("text")
.text(function(d) {
return d.id;
})
.attr('x', 6)
.attr('y', 3);
node.append("title")
.text(function(d) { return d.id; });
simulation
.nodes(graph.nodes)
.on("tick", ticked);
simulation.force("link")
.links(graph.links);
function ticked() {
node.attr("cx", function(d) { return d.x = Math.max(15, Math.min(width - 15, d.x)); })
.attr("cy", function(d) { return d.y = Math.max(15, Math.min(height - 15, d.y)); });
link.attr("x1", function(d) { return d.source.x; })
.attr("y1", function(d) { return d.source.y; })
.attr("x2", function(d) { return d.target.x; })
.attr("y2", function(d) { return d.target.y; });
node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
}
});
function dragstarted(d) {
if (!d3.event.active) simulation.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}
function dragged(d) {
d.fx = d3.event.x;
d.fy = d3.event.y;
}
function dragended(d) {
if (!d3.event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}
</script>