-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1712 lines (1562 loc) · 64 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
<?php header('Access-Control-Allow-Origin: *'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<script type="text/javascript" src="//code.jquery.com/jquery-3.1.1.js"></script>
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/VC/beeswarm.min.js"></script>
<script type="text/javascript" src="https://evanplaice.github.io/jquery-csv/src/jquery.csv.min.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/FileSaver.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/rgbcolor.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/canvg.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/svgenie.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/d3-save-svg.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/UI-Sidebar-master/sidebar.min.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/jscolor.min.js"></script>
<script type="text/javascript" src="https://perceptionexperiments.net/SDU/Libraries/tooltipster-master/dist/js/tooltipster.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://perceptionexperiments.net/SDU/Libraries/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="https://perceptionexperiments.net/SDU/Libraries/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://perceptionexperiments.net/SDU/Libraries/tooltipster-master/dist/css/tooltipster.bundle.min.css">
<link rel="stylesheet" type="text/css" href="https://perceptionexperiments.net/SDU/Libraries/UI-Sidebar-master/sidebar.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css">
<style type="text/css">
/* Turn off number spinners -- the arrows */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-moz-appearance: none;
-webkit-appearance: none;
margin: 0;
}
input[type=number] {
-moz-appearance: textfield;
-webkit-appearance: textfield;
}
body {
background: #C8C8C8;
font: normal 16px Helvetica, Arial, sans-serif;
}
input {
text-align: center;
}
body.pushable{
background: #C8C8C8 !important;
overflow: auto;
white-space: nowrap;
}
.ToolTip {
text-decoration-style: dotted; /* Only works with Firefox */
text-decoration: underline;
}
.pusher {
background: #C8C8C8 !important;
}
.ui.sidebar{
-moz-box-sizing: content-box; /* Firefox, other Gecko */
-webkit-box-sizing: content-box; /* Safari/Chrome, other WebKit */
background: white;
border-color: #000;
border-radius: 5px !important;
border-style: solid;
border-width: 4px;
box-sizing: content-box; /* Opera/IE 8+ */
height: 97% !important;
margin-bottom: 40px;
max-height: 97% !important;
padding-bottom: 10px;
z-index: 1000 !important;
}
#sideBarContainer {
box-shadow: 10px 10px 5px rgba(0,0,0,0.2);
}
.container{
max-width: 475px;
}
.fa {
margin-right: 8px;
}
.glyphicon {
font-size: 20px;
font-weight: bold;
}
.form-horizontal .control-label {
text-align: left;
}
.form-control {
height: 35px;
}
.input-group[class*="col-"]{
padding-left: 15px;
padding-right: 15px;
}
.col-sm-4.input-group, .col-sm-5.input-group {
margin: 0 auto;
}
.btn-block {
margin: 0 auto;
width: 30%;
}
.panel {
border-color: #323232;
border-width: 2px;
}
.panel-body{
white-space: normal;
word-wrap: break-word;
}
.panel-heading {
cursor: pointer;
}
.panel-default > .panel-heading-custom {
background: #323232;/* #2980b9; */
border-color: #323232;
border-radius: 0px;
color: #FFF;
}
.panel-title{
font-size: 18px;
font-weight: bold;
}
/* Make sure the title is underlined when the mouse is over the panel*/
.panel:hover .panel-title {
text-decoration: underline;
}
/* CSS Method for adding Font Awesome Chevron Icons */
.panel-heading .accordion-toggle:before {
/* symbol for "opening" panels */
color: inherit;
content:"\f077";
float: right;
font-family:'FontAwesome';
}
.panel-heading.collapsed .accordion-toggle:before {
/* symbol for "collapsed" panels */
content:"\f078";
}
.panel-group .panel+.panel {
margin-top: 10px;
}
.custom-file-button {
background: #323232; /* #2196F3; */
border-color: #323232;
border-radius: 4px;
border-style: solid;
border-width: 3px;
color: #FFF;
cursor: pointer;
display: inline-block;
font-size: 20px;
font-weight: normal;
margin-left: 30px;
padding: 6px 12px;
width: 175px;
}
.custom-file-button:hover{
background: #F0F0F0; /* #17BDFF; */
border-color: #000;
border-style: solid;
border-width: 3px;
color: #000;
}
#file {
display:none;
}
#fileLabel {
margin-left: 0px;
text-decoration: none;
}
.header{
margin-bottom: 28px;
text-align:center;
text-decoration: underline;
}
.buttonHolder{
margin-bottom: 30px;
margin: 20px auto;
text-align:center;
}
#svgHolder{
display: block;
margin: 30px auto 30px auto;
position: relative;
}
svg{
display:block;
position: relative;
}
.axis path,
.axis line {
fill: none;
shape-rendering: crispEdges;
stroke: black;
}
.axis text {
font-size: 12px;
}
#horizontalAxis text {
font-size: 20px;
}
/* On-off switch, generated by https://proto.io/freebies/onoff/ */
.onoffswitch {
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
position: relative;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
border: 2px solid #000000; border-radius: 20px;
display: block; overflow: hidden; cursor: pointer;
margin: 0 auto;
width: 100px;
}
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
box-sizing: border-box;
display: block; float: left; width: 50%; height: 34px; padding: 0; line-height: 34px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
}
.onoffswitch-inner:before {
background-color: #5CB85C; color: #FFFFFF;
content: "ON";
padding-left: 10px;
}
.onoffswitch-inner:after {
background-color: #EEEEEE; color: #999999;
content: "OFF";
padding-right: 10px;
text-align: right;
}
.onoffswitch-switch {
background: #FFFFFF;
border: 2px solid #000000; border-radius: 20px;
display: block; width: 20px; height: 20px; margin: 8px;
margin: 7px auto 7px 67px;
position: relative; top: 0; bottom: 0;
right: 60px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
/*Keep the average button centered, assuming it's a .col-sm-4 (from Bootstratp)*/
#toggleAveragesDiv {
margin-left: 16.66666%;
}
#dataEntryFormGroup .col-sm-8{
padding-bottom:15px;
}
#errorMessage {
display: none;
text-align: center;
white-space: normal;
word-wrap: break-word;
}
</style>
<title>Beeswarm Plotting Tool by Stefan Uddenberg</title>
</head>
<body>
<div id="sideBarContainer" class="ui very wide sidebar">
<div id="optionsHolder" class="container">
<h1 id="optionsHeading" class="header">Options</h1>
<div class="panel-group" id="accordion">
<!-- General panel -->
<div class="panel panel-default">
<div class="panel-heading panel-heading-custom collapsed" data-toggle="collapse" data-parent="#accordion" data-target="#generalPanel">
<h4 class="panel-title">
<a class="accordion-toggle">General</a>
</h4>
</div>
<div id="generalPanel" class="panel-collapse collapse">
<div class="panel-body">
<!-- General options -->
<form class="form-horizontal">
<!-- Title Font Size -->
<div class="form-group">
<label for="titleFontSize" id="titleFontSizeLabel" class="col-sm-4 control-label ToolTip" title="Use the plus and minus buttons to change the size, or simply type your own preferred value. All such values are in pixels, unless otherwise specified.">Graph Title Font Size</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="titleFontSizeMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="titleFontSize" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="titleFontSize" step="0.5" min="1">
<span class="input-group-btn">
<button id="titleFontSizePlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="titleFontSize" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Graph Title -->
<div class="form-group">
<label for="graphTitleEditor" id="graphTitleEditorLabel" class="col-sm-4 control-label">Graph Title</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="graphTitleEditor">
</div>
</div>
<!-- Font name -->
<div class="form-group">
<label for="fontName" id="fontNameLabel" class="col-sm-4 control-label">Font Name</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="fontName">
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Data panel -->
<div class="panel panel-default">
<div class="panel-heading panel-heading-custom collapsed" data-toggle="collapse" data-parent="#accordion" data-target="#dataPanel">
<h4 class="panel-title">
<a class="accordion-toggle">Data</a>
</h4>
</div>
<!-- Data Options -->
<div id="dataPanel" class="panel-collapse collapse">
<div class="panel-body">
<form class="form-horizontal">
<!-- Show Averages -->
<div class="form-group">
<label for="toggleAverages" id="toggleAveragesLabel" class="col-sm-4 control-label ToolTip" title="Toggle the horizontal bars showing the averages on the graph. You can customize their size using the options below.">Show Averages</label>
<div id="toggleAveragesDiv" class="onoffswitch col-sm-4">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="toggleAverages" checked>
<label class="onoffswitch-label" for="toggleAverages">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
<!-- Bar Width -->
<div class="form-group">
<label for="barWidth" id="barWidthLabel" class="col-sm-4 control-label">Average Bar Width</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="barWidthMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="barWidth" step="1">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="barWidth" step="1">
<span class="input-group-btn">
<button id="barWidthPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="barWidth" step="1">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Bar Height/Thickness -->
<div class="form-group">
<label for="barHeight" id="barHeightLabel" class="col-sm-4 control-label">Average Bar Thickness</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="barHeightMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="barHeight" step="1">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="barHeight" step="1">
<span class="input-group-btn">
<button id="barHeightPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="barHeight" step="1">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Dot Radius -->
<div class="form-group">
<label for="dotRadius" id="dotRadiusLabel" class="col-sm-4 control-label">Dot Radius</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="dotRadiusMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="dotRadius" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="dotRadius" step="0.5">
<span class="input-group-btn">
<button id="dotRadiusPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="dotRadius" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Dot Spacing Radius -->
<div class="form-group">
<label for="dotSpacingRadius" id="dotSpacingRadiusLabel" class="col-sm-4 control-label ToolTip" title="Make this bigger than the dot radius if you don't want the dots to touch.">Dot Spacing Radius</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="dotSpacingRadiusMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="dotSpacingRadius" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="dotSpacingRadius" step="0.5">
<span class="input-group-btn">
<button id="dotSpacingRadiusPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="dotSpacingRadius" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Data Colors -->
<div class="form-group">
<label for="dataColors" id="dataColorsLabel" class="col-sm-4 control-label ToolTip" title="The colors for the beeswarms. Color names should be in hexadecimal and separated by commas or spaces. Needs at least one color value.">Data Colors</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="dataColors">
</div>
</div>
<!-- Color picker -->
<div class="form-group">
<label for="colorPicker" id="colorPickerLabel" class="col-sm-4 control-label ToolTip" title="Just a color picker to help you choose colors for the beeswarms. Feel free to paste the value you choose into the 'Data Colors' section.">Color Picking Tool</label>
<div class="col-sm-8">
<input class="form-control jscolor {hash:true}" type="text" id="colorPicker">
</div>
</div>
<!-- Data Entry -->
<br/>
<h2 id="dataEntryHeading" class="header ToolTip" title="You can paste your own data here if you don't want to load it in CSV format. Make sure they're separated by commas or spaces. Spaces between data points are fine, but note that they will be replaced by commas.">Data Entry</h2>
<!-- Number of Beeswarms, or Total Group Number -->
<div class="form-group">
<label for="numBeeswarms" id="numBeeswarmsLabel" class="col-sm-4 control-label">Total Beeswarm #</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="numBeeswarmsMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="numBeeswarms" step="1">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="numBeeswarms" step="1">
<span class="input-group-btn">
<button id="numBeeswarmsPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="numBeeswarms" step="1">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<div class="form-group" id="dataEntryFormGroup">
<label for="dataGroup1" id="dataGroup1Label" class="col-sm-4 control-label">Beeswarm 1</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup1">
</div>
<label for="dataGroup2" id="dataGroup2Label" class="col-sm-4 control-label">Beeswarm 2</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup2">
</div>
<label for="dataGroup3" id="dataGroup3Label" class="col-sm-4 control-label">Beeswarm 3</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup3">
</div>
<label for="dataGroup4" id="dataGroup4Label" class="col-sm-4 control-label">Beeswarm 4</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup4">
</div>
<label for="dataGroup5" id="dataGroup5Label" class="col-sm-4 control-label">Beeswarm 5</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup5">
</div>
<label for="dataGroup6" id="dataGroup6Label" class="col-sm-4 control-label">Beeswarm 6</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup6">
</div>
<label for="dataGroup7" id="dataGroup7Label" class="col-sm-4 control-label">Beeswarm 7</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup7">
</div>
<label for="dataGroup8" id="dataGroup8Label" class="col-sm-4 control-label">Beeswarm 8</label>
<div class="col-sm-8">
<input class="form-control beeswarm-data" type="text" id="dataGroup8">
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Axis Panel -->
<div class="panel panel-default"> <!-- can also do panel-primary-->
<div class="panel-heading panel-heading-custom collapsed" data-toggle="collapse" data-parent="#accordion" data-target="#axisPanel">
<h4 class="panel-title">
<a class="accordion-toggle">Axis</a>
</h4>
</div>
<!-- Axis Options -->
<div id="axisPanel" class="panel-collapse collapse">
<div class="panel-body">
<form class="form-horizontal">
<!-- Rect Width -->
<div class="form-group">
<label for="rectWidth" id="rectWidthLabel" class="col-sm-4 control-label">Canvas Width</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="rectWidthMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="rectWidth" step="10">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="rectWidth" step="10" min="1">
<span class="input-group-btn">
<button id="rectWidthPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="rectWidth" step="10">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Rect Height -->
<div class="form-group">
<label for="rectHeight" id="rectHeightLabel" class="col-sm-4 control-label">Canvas Height</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="rectHeightMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="rectHeight" step="10">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="rectHeight" step="10" min="1">
<span class="input-group-btn">
<button id="rectHeightPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="rectHeight" step="10">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Minimum -->
<div class="form-group">
<label for="yMin" id="yMinLabel" class="col-sm-4 control-label">Vert. Axis Min. Val.</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="yMinMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="yMin" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="yMin" step="0.5">
<span class="input-group-btn">
<button id="yMinPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="yMin" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Maximum -->
<div class="form-group">
<label for="yMax" id="yMaxLabel" class="col-sm-4 control-label">Vert. Axis Max. Val.</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="yMaxMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="yMax" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="yMax" step="0.5">
<span class="input-group-btn">
<button id="yMaxPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="yMax" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Font Size -->
<div class="form-group">
<label for="verticalAxisFontSize" id="verticalAxisFontSizeLabel" class="col-sm-4 control-label">Vert. Axis Font Size</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="verticalAxisFontSizeMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="verticalAxisFontSize" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="verticalAxisFontSize" step="0.5">
<span class="input-group-btn">
<button id="verticalAxisFontSizePlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="verticalAxisFontSize" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Tick Padding -->
<div class="form-group">
<label for="verticalAxisTickPadding" id="verticalAxisTickPaddingLabel" class="col-sm-4 control-label ToolTip" title="Horizontal distance between numerical labels and tick marks on the vertical axis.">Vert. Axis Tick Padding</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="verticalAxisTickPaddingMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="verticalAxisTickPadding" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="verticalAxisTickPadding" step="0.5">
<span class="input-group-btn">
<button id="verticalAxisTickPaddingPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="verticalAxisTickPadding" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Label Font Size -->
<div class="form-group">
<label for="verticalAxisLabelFontSize" id="verticalAxisLabelFontSizeLabel" class="col-sm-4 control-label">Vert. Axis Label Size</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="verticalAxisLabelFontSizeMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="verticalAxisLabelFontSize" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="verticalAxisLabelFontSize" step="0.5">
<span class="input-group-btn">
<button id="verticalAxisLabelFontSizePlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="verticalAxisLabelFontSize" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Vertical Axis Label Padding/Distance -->
<div class="form-group">
<label for="verticalAxisLabelPadding" id="verticalAxisLabelPaddingLabel" class="col-sm-4 control-label ToolTip" title="Horizontal distance between the vertical axis label and the left edge of the canvas frame.">Vert. Axis Label Distance</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="verticalAxisLabelPaddingMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="verticalAxisLabelPadding" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="verticalAxisLabelPadding" step="0.5">
<span class="input-group-btn">
<button id="verticalAxisLabelPaddingPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="verticalAxisLabelPadding" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Horizontal Axis Font Size -->
<div class="form-group">
<label for="horizontalAxisFontSize" id="horizontalAxisFontSizeLabel" class="col-sm-4 control-label">Horiz. Axis Font Size</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="horizontalAxisFontSizeMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="horizontalAxisFontSize" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="horizontalAxisFontSize" step="0.5">
<span class="input-group-btn">
<button id="horizontalAxisFontSizePlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="horizontalAxisFontSize" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Horizontal Axis Label Padding -->
<div class="form-group">
<label for="horizontalAxisLabelPadding" id="horizontalAxisLabelPaddingLabel" class="col-sm-4 control-label ToolTip" title="Vertical distance between group labels and tick marks on the horizontal axis.">Horiz. Axis Label Padding</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="horizontalAxisLabelPaddingMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="horizontalAxisLabelPadding" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="horizontalAxisLabelPadding" step="0.5">
<span class="input-group-btn">
<button id="horizontalAxisLabelPaddingPlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="horizontalAxisLabelPadding" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Axis Stroke Width -->
<div class="form-group">
<label for="axisStroke" id="axisStrokeLabel" class="col-sm-4 control-label">Axis Stroke Width</label>
<div class="col-sm-5 input-group">
<span class="input-group-btn">
<button id="axisStrokeMinus" type="button" class="minus btn btn-danger btn-number" data-type="minus" data-field="axisStroke" step="0.5">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input class="form-control input-number" type="number" id="axisStroke" step="0.5">
<span class="input-group-btn">
<button id="axisStrokePlus" type="button" class="plus btn btn-success btn-number" data-type="plus" data-field="axisStroke" step="0.5">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>
<!-- Axis Stroke Color -->
<div class="form-group">
<label for="axisColor" id="axisColorLabel" class="col-sm-4 control-label ToolTip" title="Click on the input box to choose a new color.">Axis Stroke Color</label>
<div class="col-sm-8">
<input class="form-control jscolor {hash:true}" type="text" id="axisColor">
</div>
</div>
<!-- Horizontal Axis Labels -->
<div class="form-group">
<label for="horizontalAxisLabels" id="horizontalAxisLabelsLabel" class="col-sm-4 control-label ToolTip" title="The labels for the various beeswarms. Make sure they are separated by commas or spaces!">Group Labels</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="horizontalAxisLabels">
</div>
</div>
<!-- Vertical Axis Title -->
<div class="form-group">
<label for="verticalAxisLabelInput" id="VerticalAxisLabelInputLabel" class="col-sm-4 control-label">Vertical Axis Title</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="verticalAxisLabelInput">
</div>
</div>
</form>
</div>
</div>
</div>
<!-- About panel -->
<div class="panel panel-default">
<div class="panel-heading panel-heading-custom" data-toggle="collapse" data-parent="#accordion" data-target="#aboutPanel"> <!-- add "collapsed" to class to make the chevron start off pointing down.-->
<h4 class="panel-title">
<a class="accordion-toggle">About</a>
</h4>
</div>
<div id="aboutPanel" class="panel-collapse collapse in">
<div class="panel-body">
<p>
This is a tool designed to help you create beeswarm plots — a kind of one-dimensional scatterplot that shows every point in a data distribution. You can load your own data in CSV format (using the 'Load CSV' button above the graph), or enter your own comma-separated data (using the 'Data' tab above). You can also customize the appearance of the graph using the various options located in this menu, and then save your graph in either SVG or PNG format using the buttons above the graph. This tool works best on Google Chrome and Firefox.
</p>
<p>
For more details, please see the following paper: Uddenberg, S., & Scholl, B. J. (under review). Perceptual averaging in visual communication: Ensemble representations in the perception of scientific data in graphs.
<br /><br />
If you have any questions, please contact the author, Stefan Uddenberg, at <a href="mailto:[email protected]">[email protected]</a>.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="pageContent" class="pusher">
<div id="buttonHolder1" class="buttonHolder">
<label for="file" class="custom-file-button ToolTip" id="fileLabel" title="Load a CSV with your data in it. Each row corresponds to a different beeswarm, with each cell representing a single datapoint.">
<i class="fa fa-file-text"></i> Load CSV
</label>
<input type="file" id="file" name="file"/>
<button id='save' class="custom-file-button">
<i class="fa fa-floppy-o"></i> Save SVG
</button>
<button id='saveAsPNG' class="custom-file-button">
<i class="fa fa-photo"></i> Save PNG
</button>
</div>
<h4 id="errorMessage">There was an error getting the data CSV. Feel free to load your own data using the button above, or the 'Data Entry' section in the 'Options' menu to the left.</h4>
<div id="svgHolder"></div>
</div>
<script type='text/javascript'>
// BEESWARM PLOTTING TOOL
var sideBarOn = 0;
var csvName = 'https://crossorigin.me/https://perceptionexperiments.net/SDU/VC/BeeswarmTool/TestData.csv';
var fontName = 'Helvetica';
var titleFontSize = 30;
var horizontalAxisFontSize = 20;
var verticalAxisFontSize = 12;
var verticalAxisLabelFontSize = 20;
var alphabet = 'ABCDEFGHIJLMNOPQRSTUVWXYZ'.split("");
var yDomain;
var xDomain = [];
var graphTitle = 'Example Data';
var verticalAxisLabel = 'Y Axis Title';
var barColors = ['#F23557', '#F0D43A', '#22B2DA', '#3B4A6B']; // wes anderson style palette
var dotColorOn = 1; // whether or not the dot will have the same color as the bars
var dotStrokeOn = 0;
var dotStrokeColor = "#000000";
var dotStrokeWidth = 1;
var titleOn = 1;
var showAverages = 1;
var useScaledData = 1; // use this for raw data — leave justify and center off.
if (useScaledData == 0) {
var leftJustifyOn = 1; // whether or not to left justify the data or have it centered
var centerOn = 0; // whether or not to do a centered beeswarm plot
} else {
var leftJustifyOn = 0; // whether or not to left justify the data or have it centered
var centerOn = 0; // whether or not to do a centered beeswarm plot
}
var rectWidth = 600;
var rectHeight = 400;
var rectStrokeWidth = 4;
var rectBorderRadius = 5; // for rounded corners
var minPageWidth = rectWidth + rectStrokeWidth;
var rectBackgroundColor = "#FFF"; // hex code for color #F9F9F9
var rectStrokeColor = "#000";
var widthPadding = 80; // 30
var heightPadding = 60; // 30
var justifyPadding = 30;
var xAxisTickPadding = 15; // vertical distance between axis and label
var yAxisTickPadding = 5; // horizontal distance between axis and numerical label
var yAxisLabelPadding = widthPadding/5; // horizontal distance between left edge of rect and text label (positive values go to the right)
var dotRadius = 2;
var spacingRadius = 3;
var barWidth = 60;
var barHeight = 4;
var axisStrokeWidth = 3;
var axisStrokeColor = "#000000";
var numDataInputFields = 8;
var dataInputFieldPrefix = "dataGroup";
var barNamePrefix = "barElement";
var origData, allData, stringData, finalData, intermediateData, scaledData, formData, csvData;
var numBeeswarms, previousNumBeeswarms;
var xScale, yScale, xAxis, yAxis;
var correctAverages, numDatapoints, minVals, maxVals;
document.getElementById('save').onclick = function() {
var config = {
filename: 'customFileName',
};
d3_save_svg.save(d3.select('svg').node(), config);
createBeeswarm(formData, false);
};
document.getElementById('saveAsPNG').onclick = function() {
svgenie.save( "#mySVG", {
name : "customFileName.png"
});
};
$(document).ready(function() {
// set up tooltips
$('.ToolTip').tooltipster();
// Initialize sidebar
$('.sidebar')
.sidebar({
dimPage: false,
closable: false,
scrollLock: false
});
// Turn sidebar on
if (sideBarOn==0) {
$('.ui.sidebar').sidebar('toggle');
sideBarOn = 1;
}
getCSV(csvName);
if( isAPIAvailable() ) {
$('#file').on('change', handleFileSelect);
}
});
// Dynamic resizing
$(window).on('load resize', function(){
autoResize();
});
function autoResize() {
var windowWidth = $(window).width();
var sideBarWidth = $('#sideBarContainer').width();
var newPageWidth = windowWidth - sideBarWidth; // an extra padding of 25 just in case
if (newPageWidth <= (rectWidth + 50)) {
newPageWidth = rectWidth + 50;
}
if (newPageWidth > minPageWidth) {
$('body').width(newPageWidth+"px");
}
}
// Buttons and inputs
// Generic Plus and Minus buttons
$('.btn-number').click(function(e){
e.preventDefault();
var fieldName = $(this).attr('data-field');
var type = $(this).attr('data-type');
var increment = parseFloat($(this).attr('step'));
if (!increment) increment = 1;
var input = $("input[id='"+fieldName+"']");
var currentVal = parseFloat(input.val());
if (!isNaN(currentVal)) {
if(type == 'minus') {
var minValue = parseFloat(input.attr('min'));
if(!minValue) minValue = -9999999999999;
if(currentVal > minValue) {
input.val(currentVal - increment).change();
}
if(parseFloat(input.val()) == minValue) {
$(this).attr('disabled', true);
}
} else if(type == 'plus') {
var maxValue = parseFloat(input.attr('max'));
if(!maxValue) maxValue = 9999999999999;
if(currentVal < maxValue) {
input.val(currentVal + increment).change();
}
if(parseFloat(input.val()) == maxValue) {
$(this).attr('disabled', true);
}
}
} else {
input.val(0);
}
});
$('.input-number').focusin(function(){
$(this).data('oldValue', $(this).val());
});
$('.input-number').change(function() {
var minValue = parseFloat($(this).attr('min'));
var maxValue = parseFloat($(this).attr('max'));
if(!minValue) minValue = -9999999999999;
if(!maxValue) maxValue = 9999999999999;
var valueCurrent = parseFloat($(this).val());
var name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled');
} else {
alert('Sorry, the minimum value was reached');
$(this).val($(this).data('oldValue'));
}
if(valueCurrent <= maxValue) {
$(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled');
} else {
alert('Sorry, the maximum value was reached');
$(this).val($(this).data('oldValue'));
}
});
$("#fontName").on('keyup change click', function(e) {
fontName = $(this).val();
d3.selectAll('svg').style("font-family", fontName);
});
$("#graphTitleEditor").on('keyup change click', function(e) {
graphTitle = $(this).val();
d3.select("#graphTitle").text(graphTitle);
});
$("#titleFontSize").on('keyup change click', function(e) {
titleFontSize = $(this).val();
d3.select("#graphTitle").style("font-size", (titleFontSize+"px"));
});
$("#yMin").on('keyup change click', function(e) {
if (!$(this).is( ":focus" )) {
yDomain[0] = $(this).val();
createBeeswarm(formData, false);
}
});
$("#yMax").on('keyup change click', function(e) {
if (!$(this).is( ":focus" )) {
yDomain[1] = $(this).val();
createBeeswarm(formData, false);
}
});
$("#horizontalAxisLabels").on('keyup change click', function(e) {
if (!$(this).is( ":focus" )) {
xDomain = $(this).val();
// Split into composite parts
xDomain = xDomain.split(/[ ,]+/); //split(",");
// Remove white spaces
for (var i = 0; i < xDomain.length; i++) {
xDomain[i] = xDomain[i].trim();
}
// Recreate plot
createBeeswarm(formData, false);
// update the form
$("#numBeeswarms").val(xDomain.length);
}
});
$("#axisStroke").on('keyup change click', function(e) {
d3.selectAll(".axis").style("stroke-width", $(this).val() + "px");
axisStrokeWidth = $(this).val();
});
$("#axisColor").on('keyup change click', function(e) {
d3.selectAll(".axis").selectAll("path, line").style("stroke", $(this).val());