-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbck.index.html
203 lines (162 loc) · 4.95 KB
/
bck.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
width: 100%;
display: block;
}
.label {
font-weight: bold;
}
.tile, .zoom {
shape-rendering: crispEdges;
}
.zoom {
pointer-events: none;
stroke: #000;
stroke-width:2.5px;
}
.cell-hover {
stroke: #F00;
stroke-width:2.5px;
}
.title {
font-size: 14px;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
#inputs {
width: 78%;
float: right;
white-space: nowrap; <!-- keep everything on one line -->
vertical-align: top;
overflow: hidden;
text-align: center;
}
#interactions {
width: 18%;
float: left;
text-align: center;
}
#tree {
width: 65%;
float: left;
text-align: center;
}
#output {
width: 30%;
float: right;
text-align: center;
}
.node circle {
fill: #6D7B8D;
stroke: #6D7B8D;
//fill: #f1f1f1;
//stroke: #f1f1f1;
//stroke-width: 1px;
}
.node text { font: 12px sans-serif; }
.link {
fill: none;
stroke: #ccc;
//stroke-width: 2px; // use tree structure to set tree line width
}
.axis {
font: 10px sans-serif;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.axis .domain {
fill: none;
stroke: #000;
stroke-opacity: .3;
stroke-width: 10px;
stroke-linecap: round;
}
.axis .halo {
fill: none;
stroke: #ddd;
stroke-width: 8px;
stroke-linecap: round;
}
.slider .handle {
fill: #fff;
stroke: #000;
stroke-opacity: .5;
stroke-width: 1.25px;
cursor: crosshair;
}
</style>
<link rel="stylesheet" href="css/d3.slider.css" />
<script type="text/javascript" src="./d3/d3.js"></script>
<script type="text/javascript" src="./scripts/d3.slider.js"></script>
<script type="text/javascript" src="./scripts/d3-scale.v0.7.min.js"></script>
<script type="text/javascript" src="./scripts/tree_styling.js"></script>
<script type="text/javascript" src="./scripts/generate_images.js"></script>
<script type="text/javascript" src="./scripts/generate_tree.js"></script>
<script type="text/javascript" src="./scripts/slider.js"></script>
</head>
<body>
<div id="interactions"><h1>Parameters</h1>
Tree Depth<br></br>
<div class="depth_slider"></div>
<br></br>
Number of Trees in Forest<br></br>
<div class="forest_slider"></div>
</div>
<div id="inputs"><h1>Features</h1></div>
<div id="tree"><h1>Tree</h1></div>
<div id="output"><h1>Outputs</h1></div>
<script>
// ************** Generate the images *****************
outerWidth_input = (.78/4)*window.innerWidth; // 78% of the screen (div width) / 4 images = 1/5
outerHeight_input = outerWidth_input; // make a square image
outerWidth_output = outerWidth_input; // These have to be the same size still. Need to figure out how to account
outerHeight_output = outerHeight_input; // for different translations of the zoom rects if we want these to be different. - Matt
// Make the input and output images
show_image("data/Height.txt", outerWidth_input, outerHeight_input, "Height", "#inputs");
show_image("data/Potential.txt", outerWidth_input, outerHeight_input, "Potential", "#inputs");
show_image("data/Phase.txt", outerWidth_input, outerHeight_input, "Phase", "#inputs");
show_image("data/Amplitude.txt", outerWidth_input, outerHeight_input, "Amplitude", "#inputs");
show_output("data/Photoluminescence.txt", "data/Photoluminescence.txt", outerWidth_output, outerHeight_output, "Photoluminescence", "#output");
// ************** Generate the default tree diagram *****************
generate_tree("python/results/4_depth_1_trees_1_estimator.json");
// ************** Generate the sliders *****************
depth_slider = d3.slider().scale(d3.scale.ordinal().domain([1,2,3,4,5]).rangePoints([0, 1], 0.5)).axis(d3.svg.axis()).snap(true).value(4);
forest_slider = d3.slider().scale(d3.scale.ordinal().domain([1,2,3,4,5,6,7,8]).rangePoints([0, 1], 0.5)).axis(d3.svg.axis()).snap(true).value(4);
d3.select('.depth_slider').call(depth_slider);
d3.select('.forest_slider').call(forest_slider);
depth_slider.on("slide", function(evt, value) {
update(value);
});
forest_slider.on("slide", function(evt, value) {
//update(value);
});
// Value is the value of the slider (i.e. the Tree Depth or # of Trees etc.)
function update(value) {
if(value >= 2 && value <= 4) {
var dataset = "data/Height.txt";
} else {
var dataset = "data/Photoluminescence.txt";
}
var tree = value + "_depth_4_trees_1_estimator.json";
update_output(dataset, "data/Photoluminescence.txt", outerWidth_output, outerHeight_output, "Photoluminescence", "#output")
//update_tree("python/results/" + tree); // doesn't update
generate_tree("python/results/" + tree);
}
// The variable trees_drawn is used to
// determine whether draw_tree is drawing the first
// tree or re-drawing a new one.
// If it is a replacement tree, we want to delete the old one.
var trees_drawn = 1
</script>
</body>
</html>