forked from tt-acm/DesignExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1944 lines (1476 loc) · 72.6 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
//The MIT License (MIT)
//
//Copyright (c) 2015 Thornton Tomasetti, Inc.
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//THE SOFTWARE.
-->
<!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">
<meta name="description" content="">
<meta name="author" content="">
<title>Design Explorer</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" type="image/png" href="favicon.png">
<!-- D3 -->
<script src="./d3/d3.v3.min.js" charset="utf-8"></script>
<!-- jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Sliders script and css -->
<script src="./rangeslider_files/js/ion.rangeSlider.js"></script>
<link rel="stylesheet" href="./rangeslider_files/css/normalize.css" />
<link rel="stylesheet" href="./rangeslider_files/css/ion.rangeSlider.css" />
<link rel="stylesheet" href="./rangeslider_files/css/ion.rangeSlider.skinNice.css"/>
<!-- Parallel Coordinates -->
<script type="text/javascript" src = "http://mostapharoudsari.github.io/Honeybee/pc_source_files/d3/d3.parcoords.js"></script>
<!-- D3 Parallel Coordinates CSS -->
<link rel="stylesheet" type="text/css" href="./pc_source_files/css/d3.parcoords.css">
<!-- Radar Chart -->
<script type="text/javascript" src="./radar_source_files/radar-chart.js"></script>
<!-- Radar Chart CSS -->
<link rel="stylesheet" type="text/css" href="./radar_source_files/radar-chart.css"/>
<!-- Bootstrap Core CSS -->
<link href="bootstrap_side_bar/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="bootstrap_side_bar/css/simple-sidebar.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Various libraries that vA3C depends upon -->
<script type="text/javascript" src="va3c_source_files/js/libs/dat.gui.js"></script>
<link rel="stylesheet" type="text/css" href="va3c_source_files/css/datgui_styleOverride.css">
<script type="text/javascript" src="va3c_source_files/js/libs/three.js"></script>
<script type="text/javascript" src="va3c_source_files/js/libs/OrbitControls.js"></script>
<script type="text/javascript" src="va3c_source_files/js/libs/Projector.js"></script>
<script type="text/javascript" src="va3c_source_files/js/libs/stats.js"></script>
<script type="text/javascript" src="va3c_source_files/js/libs/jquery-ui.js"></script>
<!-- Application Files -->
<link rel='stylesheet' type='text/css' href='https://rawgit.com/tt-acm/Spectacles.WebViewer/gh-pages/css/SPECTACLES.css'/> <!-- the vA3C stylesheet -->
<script type="text/javascript" src="https://rawgit.com/tt-acm/Spectacles.WebViewer/gh-pages/js/SPECTACLES.js"></script> <!-- the vA3C library -->
<!-- Pace for loading bar-->
<link rel='stylesheet' type='text/css' href='pace/pace.css'/>
<script type="text/javascript" src="pace/pace.min.js"></script>
<!-- rating system -->
<script src='./rating_source_files/jquery.rating.js' type="text/javascript" language="javascript"></script>
<link href='./rating_source_files/jquery.rating.css' type="text/css" rel="stylesheet"/>
<!-- Design Explorer Scripts -->
<script src='./js/designExplorer.js' type="text/javascript" language="javascript"></script>
<style>
body {
font-family: sans-serif;
font-size: 12px;
}
div {
background-color: white;
}
input {
display: inline-block;
font-family: sans-serif;
font-size: 12px;
}
output {
display: inline-block;
font-size: 11px;
font-weight: bold;
color: red;
}
/* centered columns styles */
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:left;
/* inline-block space fix */
margin-right:-4px;
}
.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one */
display: flex;
align-items: center;
}
.footer {
width: 95%;
height: 20px;
position: absolute;
bottom: 10px;
left: 10px;
}
.credit{
margin-left: 1em;
margin-bottom: .5em;
}
.fullscreen{
top: 0;
left: 0;
height: 100% !important;
width: 100% !important;
position: fixed !important;
z-index: 1001 !important;
overflow: auto;
}
#thumbnails-side img,
#thumbnails-btm img {
width: 100%;
margin-top: 1em;
border-radius: 50%;
}
#thumbnails-side img {
border: .3em solid;
}
#thumbnails-btm img {
border: .5em solid;
}
#zoomed img,
#zoomedArea img {
height: 100%;
width: auto;
display:block; /* to center the imge - hopefully! */
margin-left:auto;
margin-right:auto;
}
#thumbnails-side,
#thumbnails-btm {
overflow: auto;
height: 100%;
}
#thumbnails-btm_container,
#zoomedArea {
overflow: hidden;
}
#legend{
overflow-y: auto;
overflow-x: hidden;
}
rect.disabled {
fill: transparent !important;
}
.navbar-default {
height: 50px; /* overwrite default navbar size */
}
.Spectacles_Footer{
visibility: hidden;
}
.sampleImage {
width:100%;
cursor: pointer;
}
.sampleImage:hover img{
border-color: black;
border-width: .2em solid;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-default" style="margin-bottom:0">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#buttons-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header" title="Design Explorer">
<img style="max-width:350px; padding-top: 10px;" src="./img/DesignExplorerLogo3.png">
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="buttons-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<!--button to load csv uncommented-->
<p class="navbar-text">
<input type="file" id="csv-file" class="btn btn-default btn-sm" name="files"/>
</p>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
</nav>
<div id="wrapper" class="toggled">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<div id= "legend-heading" class="sidebar-brand col-xs-12" style="text-align:center"></div>
<div class="legend col-xs-12" id="legend">
<!--place holder for legends-->
</div>
<div id= "sliders-heading" class="sidebar-brand" style="text-align:center">
LOAD YOUR DATA!
</div>
<div class="inputSliders col-xs-11" id="inputSliders">
<form class="sliders"> <!-- I will use this form to disable all the sliders together. -->
</form>
</div>
<div id= "sliders-report" class="sidebar-brand col-xs-12" style="text-align:center"></div>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="row">
<div class="col-lg-9">
<div class="row">
<div class="btn-group col-xs-12">
<button type="button" class="btn btn-default btn-xs" id="menu-toggle" title="Show sliders">
<span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-xs" id ="pcgraph" data-toggle="collapse">
<span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span>
</button>
<button id="reset" class="btn btn-default btn-xs">Reset Selection</button>
<button id="remove" class="btn btn-default btn-xs">Exclude Selection</button>
<button id="keep" class="btn btn-default btn-xs">Zoom to Selection</button>
<button id="savecsv" class="btn btn-default btn-xs" onclick = saveToCSV()>Save Selection to File</button>
<a href="https://github.com/tt-acm/DesignExplorer/wiki" class="btn btn-default btn-xs" target="_blank">
Info <span class="glyphicon glyphicon-new-window"></span>
</a>
</div>
</div>
<!-- parallel coordinates -->
<div class="row-fluid">
<div id="graph" class="parcoords collapse in">
<!-- <h1>Parallel coordinates graph</h1> -->
</div>
</div>
<!-- Zoomed div for zoomed in areas -->
<div class="row-fluid">
<div class="zoomed" id="zoomedArea" style="height:0px">
<div class="pull-right" id="vis">
<form>
<label><input type="radio" id="toggleView" name="visMode" value="2D" checked> 2D</label> <!-- show 2D image on load-->
<label><input type="radio" id="toggleView" name="visMode" value="3D"> 3D</label>
<button type="button" class="btn btn-default btn-xs" id="toggleComments" style="margin-right:10px; margin-left:5px; margin-top: 2px;" title="Add Comments">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-xs" id="fullscreentoggle" style="margin-right:10px; margin-left:5px; margin-top: 2px;" title="Full Screen Toggle">
<span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
</button>
</form>
<form>
<!--rating div-->
<input class="star" type="radio" name="rating" value="1"/>
<input class="star" type="radio" name="rating" value="2"/>
<input class="star" type="radio" name="rating" value="3"/>
<input class="star" type="radio" name="rating" value="4"/>
<input class="star" type="radio" name="rating" value="5"/>
</form>
</div>
<div id = "viewer3d" style="width:100%; height:100%" class="hidden">
<!-- place holder for the viewer -->
</div>
<div class="zoomed" id = "zoomed" style="width:100%; height:100%">
<!-- place holder for the image -->
</div>
</div>
</div>
</div> <!-- end of left side charts-->
<div class="col-lg-3">
<div class="row-fluid">
<div class="btn-group col-xs-12">
<a href="http://core.thorntontomasetti.com/" class="btn btn-default btn-xs" target="_blank">
© Copyright 2015 CORE studio | Thornton Tomasetti
</a>
<button type="button" class="btn btn-default btn-xs" id="rcgraph" data-toggle="collapse" data-target="#radarChart">
<span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span>
</button>
</div>
</div>
<div class="row">
<div id="radarChart" class="col-lg-12 collaps in center-block" style="font-size:14px; font-weight:bold">
<!-- <h5>Radar Chart Place Holder</h5> -->
</div>
</div>
<div class="row">
<div class="col-lg-12" id="thumbnails-side_container" style="height:0px">
<div id="sorting" class="col-lg-12" style="float:right; margin-top: 2px;"></div>
<div id="thumbnails-side" class="col-lg-12">
<!-- <p>Thumbnails on load</p> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row-fluid col-lg-12">
<div class="col-lg-12" id="thumbnails-btm_container">
<div id="sorting" class="col-lg-12" style="float:right; margin-top: 2px;"></div>
<div class="col-lg-12" id="thumbnails-btm"></div>
</div>
</div>
</div>
</div>
<div class="row-fluid col-lg-12 row-centered vertical-center fullscreen" id="welcome">
<div class="col-sm-12 col-centered" id="welcomeContainer" style="opacity: 1" >
<button id="close" class="btn btn-default btn-sm pull-right">
<span class="glyphicon glyphicon-remove"></span>
</button>
<h1 class="text-center"> Welcome to Design Explorer!</h1>
<br>
<h4 class="text-center">
Design Explorer is an open source web interface for exploring multi-dimensional design spaces!
</h4>
<br><br>
<h3 class="text-center">Try one of sample design sets</h3>
<br>
<div class="row">
<div class="col-sm-4">
<img src = "https://dl.dropboxusercontent.com/u/16228160/DesignExplorer/gif/RedBox.gif" class="sampleImage image-rounded" id="sample1">
</div>
<div class="col-sm-4">
<img src="https://dl.dropboxusercontent.com/u/16228160/DesignExplorer/gif/Daylighting.gif" class="sampleImage image-rounded" id="sample2">
</div>
<div class="col-sm-4">
<img src = "https://dl.dropboxusercontent.com/u/16228160/DesignExplorer/gif/BoxBuilding.gif" class="sampleImage image-rounded" id="sample3">
</div>
<br><br>
</div>
<div class="col-lg-12">
<h2 class="text-center"> Happy Exploring! </h2>
<br><br>
<h5 class="text-center">
Design Explorer © Copyright 2015 CORE studio | Thornton Tomasetti |
<a href="http://core.thorntontomasetti.com/about" target="_blank"> About</a> |
<a href="http://core.thorntontomasetti.com/about/services" target="_blank">Services</a> |
<a href="http://core.thorntontomasetti.com/about/contact" target="_blank">Contact</a> |
</h5>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
<!-- Bootstrap Core JavaScript -->
<script src="bootstrap_side_bar/js/bootstrap.min.js"></script>
<!-- Hide sliders if user asked for a stripped down version -->
<script type="text/javascript">
// A dictionary to carry users input to customize the interface
var inputParameters = { "min": false}; // currently only a single item, other options to be added later
// get url parameters
// current valid key is on "min" for minimum interface
function parseUri(){
var pars = window.location.search.replace("?","").split("&")
if (pars[0]=="") return null;
pars.forEach(function(d){
keyValue = d.split("=");
inputParameters[keyValue[0].toLowerCase()] = keyValue[1].toLowerCase();
})
}
// read optional url parameters
parseUri();
if(inputParameters["min"] == 'true'){
// remove the button so sliders are hidden
d3.selectAll("button#menu-toggle").remove();
}
</script>
<script type="text/javascript">
sampleFiles = {
1:"design_explorer_data/LittleRedBox.csv",
2: "design_explorer_data/default_onload.csv",
3: "design_explorer_data/AIA building.csv"
}
d3.selectAll(".sampleImage")
.on("click", function(){
var selSample = d3.select(this);
var id = selSample[0][0].id.replace("sample","");
var filePath = sampleFiles[id];
// remove the current selection
unloadPageContent();
d3.select("div#welcome").remove();
// load the new file
d3.csv(filePath, loadDataToDesignExplorer);
});
</script>
<!-- Dynamic Divs script -->
<script>
var isAnyItemSelected = false;
var isToggled = true;
// side bar for sliders
$("#menu-toggle").click(function(e) {
e.preventDefault();
//$("#wrapper").toggleClass("toggled");
isToggled = !isToggled;
d3.select("#wrapper")
.classed("toggled", isToggled)
.transition().duration(500) //length of toggle animation
.each("end", resizeRadarChart())
});
// update layout on select
function updateLayoutOnSelect(){
var selectedImage = d3.select(this);
// update rating based
setStarValue(selectedImage.data()[0].Rating);
// find height of parallel coordinate
// to find the height for zoomed div
var pcHeight = d3.select("#graph")
.style("height").replace("px", "");
// show zoomed area
d3.selectAll(".zoomed")
.transition().duration(1500)
.style("height", (cleanHeight - pcHeight) + "px");
// hide btm thumbnail
d3.select("#thumbnails-btm_container")
.transition().duration(1000)
.style("height", "0px");
// push the image to zoomed area
d3.selectAll(".zoomed")
.select("img")
.data(selectedImage.data())
.attr("src", selectedImage.datum()["img"])
.attr("title", getTitle);
// highlight the line graph
graph.highlight(selectedImage.data());
// load 3d geometry if the view is set to 3D
if (currentView=="3D") loadNew3DModel();
if (!isAnyItemSelected){
// if there is a brushed selection
// update the range of the sliders
updateSlidersTickValues();
}
// update the values for slider
updateSlidersValue(graph.highlight()[0]);
// enable sliders
enableAllSliders();
//highlight the radar chart
rc.highlight(selectedImage.data());
var radarHeight = d3.select("#radarChart")
.style("height").replace("px", "");
// let's side thumbnail show up
d3.select("#thumbnails-side_container")
.transition().duration(1500)
.style("height", (cleanHeight - radarHeight) + "px");
isAnyItemSelected = true;
};
// update layout on select
function updateLayoutOnDeselect(){
// find height of parallel coordinate
// to find the height for thumbnail div
var pcHeight = d3.select("#graph")
.style("height").replace("px", "");
// hide zoomed area
d3.selectAll(".zoomed")
.transition().duration(1500)
.style("height", "0px");
// show btm thumbnail
d3.select("#thumbnails-btm_container")
.transition().duration(1000)
.style("height", (cleanHeight - pcHeight) + "px");
// hide side thumbnail
d3.select("#thumbnails-side_container")
.transition().duration(1500)
.style("height", "0px");
// unhighlight the line graph
graph.unhighlight();
// enable sliders
disableAllSliders();
// unhighlight the radar chart
rc.unhighlight();
//show radar chart
$("#radarChart").collapse("show");
isAnyItemSelected = false;
};
// hide/show parallel coordinates
d3.select("#pcgraph").on("click", function() {
if (cleanedData.length==0) return; // don't let the user change the size before loading the file
var height = d3.select("#graph").style("height").replace("px", "");
if (height!=0){
// collapse
d3.select("#graph")
.attr("class", "parcoords collapse 2s")
.transition().duration(200)
.style("height", "0px");
//disable buttons
d3.select("#reset").classed("disabled", true);
d3.select("#remove").classed("disabled", true);
d3.select("#keep").classed("disabled", true);
if (graph.highlight().length!=0){
d3.selectAll(".zoomed")
.transition().duration(1)
.style("height", cleanHeight + "px")
.each("end", function(){
// resize view
if(currentView=="3D"){
va3cViewer.viewerDiv.resize();
}
});
}else{
//mirror collapse behavior with radar chart
$("#radarChart").collapse("hide");
d3.select("#thumbnails-btm_container")
.transition().duration(1000).style("height", cleanHeight + "px");
}
}else{
// collapse in
d3.select("#graph")
.transition("ease out").attr("class", "parcoords collapse in")
.transition().duration(350)
//.transition().duration(2000)
.style("height", graphHeight + "px");
//enable buttons
d3.select("#reset").classed("disabled", false);
d3.select("#remove").classed("disabled", false);
d3.select("#keep").classed("disabled", false);
// if there is a selecion let it in
if (graph.highlight().length!=0){
d3.selectAll(".zoomed")
.transition().duration(2000).style("height", zoomedHeight + "px");
}else{
//mirror collapse behavior with radar chart
$("#radarChart").collapse("show");
d3.select("#thumbnails-btm_container")
.transition().duration(1000).style("height", zoomedHeight + "px");
}
}
});
//hide/show radar chart
d3.select("#rcgraph").on("click", function() {
if (cleanedData.length==0) return; // don't let the user change the size before loading the file
var height = d3.select("#radarChart").style("height").replace("px", "");
if (height > 1) {
if (!isAnyItemSelected) {
//collapse parcoords if there is nothing selected
d3.select("#graph")
.attr("class", "parcoords collapse 2s")
.transition().duration(200)
.style("height", "0px");
//disable buttons
d3.select("#reset").classed("disabled", true);
d3.select("#remove").classed("disabled", true);
d3.select("#keep").classed("disabled", true);
d3.select("#thumbnails-btm_container")
.transition().duration(1000).style("height", cleanHeight + "px");
}
//collapse radar chart
$("#radarChart").collapse("hide");
// set height for thumbnails-side_container
d3.select("#thumbnails-side_container")
.transition().duration(1500)
.style("height", cleanHeight + "px");
} else {
if (!isAnyItemSelected) {
//expand parcoords
d3.select("#graph")
.transition("ease out").attr("class", "parcoords collapse in")
.transition().duration(350)
//.transition().duration(2000)
.style("height", graphHeight + "px");
//enable buttons
d3.select("#reset").classed("disabled", false);
d3.select("#remove").classed("disabled", false);
d3.select("#keep").classed("disabled", false);
d3.select("#thumbnails-btm_container")
.transition().duration(1000).style("height", zoomedHeight + "px");
}
//expand radar chart
$("#radarChart").collapse("show");
// not the best practice - I should get it to work in a cleaner way
setTimeout( function(){
var rcheight = d3.select("#radarChart").style("height").replace("px", "");
// set height for thumbnails-side_container
d3.select("#thumbnails-side_container")
.transition().duration(1000)
.style("height", (cleanHeight - rcheight) + "px");
}, 500);
}
})
</script>
<!-- radar chart -->
<script type="text/javascript">
// update radar chart
function updateRadarChart(){
//format data for radar chart
var outputKeys = d3.keys(outputData[0]);
if (graph.brushed().length > 0) {
var selectedData = graph.brushed();
} else {
var selectedData = graph.data();
}
//var selectedData = graph.brushed();
selectedDataFormatted = [];
radarChartColors = [];
selectedData.forEach(function(d) {
selectedDataFormatted.push(formatData(d));
//debugger;
radarChartColors.push(color(d[pcIsColoredBy]));
})
//get height, width for radar chart
//we want the graph to be centered above the thumbnails
//65px is to fit text
var divWidth = d3.select("#thumbnails-side").style("width").replace("px", "");
var pcHeight = d3.select("#graph").style("height").replace("px", "");
var rcDimension = Math.min(pcHeight, divWidth) - 65;
radarGrey = "rgb(160,160,160)";
//configure radar chart
cfg = ({
w: rcDimension,
h: rcDimension,
color: function(){return radarGrey;},
radius: 4,
maxValue: 100,
extraWidthX: divWidth - rcDimension,
extraWidthY: 65,
translateX: (divWidth - rcDimension) / 2,
translateY: 65 / 2,
levels: 5,
});
RadarChart.draw("#radarChart", selectedDataFormatted, cfg);
//move lines to back
d3.selectAll(".area").moveToBack();
//did not work using CSS
d3.selectAll(".rclegend")
.style("fill", "steelblue")
.style("font-size", 9);
}
//resize radar chart
function resizeRadarChart() {
return;
var divWidth = d3.select("#thumbnails-side").style("width").replace("px", "");
var pcHeight = d3.select("#graph").style("height").replace("px", "");
if (pcHeight > 0) {
var rcDimension = Math.min(pcHeight, divWidth) - 65;
} else {
var rcDimension = divWidth - 65;
}
cfg.w = rcDimension;
cfg.h = rcDimension;
cfg.extraWidthX = divWidth - rcDimension;
cfg.translateX = (divWidth - rcDimension) / 2;
cfg.transitionDuration = 0;
RadarChart.draw("#radarChart", selectedDataFormatted, cfg);
//move lines to back
d3.selectAll(".area").moveToBack();
//did not work using CSS
d3.selectAll(".rclegend")
.style("fill", "steelblue")
.style("font-size", 9);
if (graph.brushed().length > 0) {
rc.updateData(graph.brushed());
}
if (graph.highlighted().length > 0) {
rc.highlight(graph.highlighted());
}
}
// clean radar chart
function cleanRadarChart() {
d3.selectAll(".radar-chart").remove();
}
</script>
<!-- process input data -->
<script type="text/javascript">
// this script imports the csv file and does the initial data processing
// such as separating inputs, outputs, images, etc.
var originalData, //csv as it is imported
cleanedData = [], //all the columns to be used for parallel coordinates
inputData = [], // columns with input values - to be used for sliders
outputData = [], // columns with output values - to be used for radar graph
slidersInfo = [], // {name:'inputName', tickValues : [sorted set of values]},
currentSliderValues = {}, // collector for values
allDataCollector = {},
slidersMapping = {}, // I collect the data for all the input sliders here so I can use it to remap the sliders later
ids = []; // Here I collect all data based on a unique ID from inputs
function analyzeInputData(originalData){
var keys = d3.keys(originalData[0]);
originalData.forEach(function(row, rowCount){
var inputParams = {},
outputParams = {},
cleanedParams = {};
keys.forEach(function(key, i){
if (key.trim().startsWith("in:")){
inputParams[key.replace("in:", "").trim()] = row[key];
cleanedParams[key.replace("in:", "").trim()] = row[key];
}else if(key.trim().startsWith("out:")){
outputParams[key.replace("out:", "").trim()] = row[key];
cleanedParams[key.replace("out:", "").trim()] = row[key];
}else{
cleanedParams[key.trim()] = row[key]; // I need to add case for image and 3D here later
}
});
var id = getCaseId(inputParams);
ids.push(id);
allDataCollector[id] = {};
//allDataCollector[id]["inputData"] = inputParams; //don't need them for now
//allDataCollector[id]["outputParams"] = outputParams;
allDataCollector[id]["cleanedParams"] = cleanedParams;
inputData.push(inputParams);
outputData.push(outputParams);
cleanedData.push(cleanedParams);
});
// add rating of 0 to all the options if not already there
if (keys.indexOf("Rating")==-1) {
cleanedData.forEach(function(d){
d.Rating = 0;
});
}
}
function getCaseId(inputParams){
// create the id based on inputs
var params = [];
d3.keys(inputParams).forEach(function(key){
// remove spaces
//var k = key.replace(/\s/g, '');
// convert to numbers and back to string
// so zeros doesn't make inconsistency
if (isNaN(inputParams[key])){
var value = inputParams[key];
}else{
var value = parseFloat(inputParams[key]);
}
// add them to params
//params.push(k);
params.push(value);
});
// join all of them together
var id = params.join("");
return id;
}
function prepareSlidersInfo(){
var sliderNames = d3.keys(inputData[0]);
var tickValues = {};
var originalTickValues = {}; // keep track of original values
// create an object with place holder for tickValues
sliderNames.forEach(function(name){
originalTickValues[name]= [];
tickValues[name] = [];
slidersMapping[name] = {};
});
// find tick values
inputData.forEach(function(d, i){
sliderNames.forEach(function(name){
// check if the value is already in list - add it to the list if not
if(tickValues[name].indexOf(d[name])==-1){
slidersMapping[name][d[name]] = []; // create an empty list for this value
tickValues[name].push(d[name]);
originalTickValues[name].push(d[name]);
}
//add the new combination to the list
slidersMapping[name][d[name]].push(cleanedData[i]);
});
});
// sort values and collect them
sliderNames.forEach(function(name){
var tValues = tickValues[name].sort();
var oValues = originalTickValues[name].sort();
slidersInfo.push({name: name, originalTickValues:oValues , tickValues: tValues});
});
// take care of whitespace in slider names! oh people...
slidersInfo.forEach(function(d){d.namewithnospace = d.name.replace(/\s/g, '');});
}
</script>