-
Notifications
You must be signed in to change notification settings - Fork 0
/
space_explore__.php
executable file
·242 lines (186 loc) · 7.47 KB
/
space_explore__.php
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
<?php
session_start();
//$val = $_POST['attr_data'];
if(!empty($_POST['attr_data'])) {
//$attrdatastr is a json string
$attrdatastr = $_POST['attr_data'];
$attrdata = json_decode($_POST['attr_data']);
//$attrdata is an object array, the structure is:
//[{"attr_name": "some-name", "min_value": 24, "max_value": 34.2}, {...}, {...}]
//to refer to value, we can write as:
// foreach($attrdata as $attr_item) {...}
// inside the loop, we can use $attr_item -> {'attr_name'} to refer to 'attr_name' value
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Space Explore</title>
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link href="css/style.css" rel="stylesheet">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.1.0.min.js"></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<!-- scatter plot draw function -->
<script src="js/map_draw.js"></script>
<script src="js/scatterplot_draw.js"></script>
<script src="js/mixed_draw.js"></script>
<style>
#chart {
height: 600px;
width: 790px;
margin: 0;
padding: 0;
}
#legend {
width: 118px;
height: 131px;
font-family: Arial, sans-serif;
background: #fff;
padding: 10px;
margin: 10px;
}
#legend img {
vertical-align: middle;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-11 text-center">
<h2 class="">Explore By Example:</h2>
<h4>An Automatic User Navigation System for Interactive Data Exploration</h4>
</div>
<form class="col-md-1 large-top-margin" action="connect.php" method="post">
<?php
echo "<label>{$_SESSION["username"]}</label>";
?>
<button type="submit" class="btn btn-default">Logout</button>
</form>
</div>
<div class="row">
<div class="col-md-12">
<hr>
</div>
</div>
<div class="row">
<div class="col-md-12">
<nav>
<ul class="pager">
<li class="previous"><a href="attribute_select.php"><span aria-hidden="true">←</span> Go Back</a></li>
</ul>
</nav>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">AIDE: Interactive Data Exploration</h4>
</div>
<div class="panel-body">
<div class="col-md-9" id='chart'>
</div>
<div class="col-md-3">
<form class="form-horizontal">
<div class="form-group">
<label for="" class="col-md-5 control-label">X Attribute:</label>
<div class="col-md-7">
<select class="form-control" id='x-attr-name'>
<?php
foreach($attrdata as $attr_item) {
echo "<option>{$attr_item -> {'attr_name'}}</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-5 control-label">Y Attribute:</label>
<div class="col-md-7">
<select class="form-control" id='y-attr-name'>
<?php
foreach($attrdata as $attr_item) {
echo "<option>{$attr_item -> {'attr_name'}}</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-5 control-label">Initial Sampling:</label>
<div class="col-md-7">
<div class="btn-group-vertical" role="group" aria-label="...">
<button type="button" class="btn btn-default" id="initial-sampling-start-btn">Start</button>
<button type="button" class="btn btn-default" id="resample-btn">Resample</button>
<button type="button" class="btn btn-default" id="switch">switch</button>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-5 control-label">Exploration:</label>
<div class="col-md-7">
<div class="btn-group-vertical" role="group" aria-label="...">
<button type="button" class="btn btn-default" id="explore-start-btn">Start</button>
<button type="button" class="btn btn-default" id="next-iteration-btn">Next Iteration</button>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-5 control-label">Label:</label>
<div class="col-md-7">
<select class="form-control" id="point-label">
<option>positive</option>
<option>negative</option>
</select>
</div>
</div>
<?php
echo "<input type='hidden' name='attr_range_data' id='attr_range_data_input' value='{$attrdatastr}'>\n";
?>
</form>
<ul class="list-group bottom-align">
<li class="list-group-item">
<span class="badge" id="list_num_samples">0</span>
Number of Samples
</li>
<li class="list-group-item">
<span class="badge" id="list_num_positive">0</span>
Positive Samples
</li>
<li class="list-group-item">
<span class="badge" id="list_num_negative">0</span>
Negative Samples
</li>
<li class="list-group-item">
<span class="badge" id="list_iterations">0</span>
Iterations
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}
else{
$_SESSION['error_message'] = "Error: No attribute ranges specified. " . " <br />" . "Please provide the ranges of at least two attributes to explore. " . " <br />";
header('location:empty_attribute.php');
exit();
}
?>