forked from OpenExoplanetCatalogue/oec_web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
correlations.html
737 lines (680 loc) · 24.8 KB
/
correlations.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
<?include(".inc/prepend.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- If this is run as a php script on a server, you can include your own header that includes a navigation bar, and other stylistic features -->
<script language="php"> include "./.inc/header.php"; if (false){ </script>
<!-- ** start server side header ** -->
<head profile="http://www.w3.org/2005/10/profile">
<link rel="icon" type="image/ico" href="favicon.ico" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/><meta name="description" content="description"/>
<title>Open Exoplanet Catalogue</title>
<link rel="stylesheet" type="text/css" href="./css/style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="./css/tables.css" media="screen" />
<script type="text/javascript" src="./js/d3.v3.min.js"></script>
<script type="text/javascript" src="./js/rgbcolor.js"></script>
<script type="text/javascript" src="./js/canvg.js"></script>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/oec_numberformatter.js"></script>
</head>
<body>
<div class="outer-container">
<div class="inner-container">
<div class="content">
<!-- ** end server side header ** -->
<script language="php"> } </script>
<!-- ########################### -->
<h2><img src="./img/kig.png" alt="kig" />Correlation diagrams</h2>
<p>This page is currently under development.
It uses the d3 javascript library to render correlation plots directly in your browser.
Once you've loaded this page, you can change the plot even without an internet connection.
The plots shows a scatter plot of all discovered planets.
Hover over a circle to see to which planet it corresponds. Click on it to view the planet's page.
</p>
<!-- ########################### -->
<div id="viz" style="float:left; font-size:12px;"></div>
<div id="pop-up">
<div id="pop-up-title">Title</div>
<div id="pop-up-description">Description</div>
<div id="pop-up-values">Values</div>
</div>
<!-- ########################### -->
<div class="spacer"></div>
<table cellspacing="0" summary="Settings" style="float:left">
<thead>
<tr>
<th scope="col" class="nobg"> </th>
<th scope="col">Options<br/> <small>The plot updates automatically when an option is changed.</small> </th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="4" scope="row">
<label>x-axis</label>
</th>
<td>
<select name="xaxis" id="xaxis" onchange="updatePlot()">
<option selected="selected" value="semimajoraxis">Semi-major axis [AU]</option>
<option value="mass">Mass [MJup]</option>
<option value="radius">Radius [RJup]</option>
<option value="period">Period [days]</option>
<option value="eccentricity">Eccentricity</option>
<option value="temperature">Temperature [K]</option>
<option value="inclination">Inclination [deg]</option>
<option value="discoveryyear">Discoveryyear</option>
<option value="numberofplanetsinsystem">Number of planets in system</option>
<option value="numberofstarsinsystem">Number of stars in system</option>
<option value="declination">Declination [deg]</option>
<option value="rightascension">Right ascension [h]</option>
<option value="distance">Distance from Earth [pc]</option>
<option value="age">Stellar age [Gyrs]</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="logscalex"><input checked="checked" name="logscale" type="checkbox" value="x" id="logscalex" onclick="updatePlot()"/>Logarithmic scale</label>
</td>
</tr>
<tr>
<td>
<label for="xrangeauto"><input checked="checked" name="xrangeauto" type="checkbox" value="a" id="xrangeauto" onclick="xrangeUpdate()"/>Automatic range</label>
</td>
</tr>
<tr>
<td id="xrangerow" style="display:none;">
range = [<input type="text" name="xrangel" size="8" value="0" onkeyup="xrangeUpdate()"/>,
<input type="text" name="xranger" size="8" value="0" onkeyup="xrangeUpdate()"/>]
</td>
</tr>
<tr>
<th rowspan="4" scope="row">
<label>y-axis</label>
</th>
<td>
<select name="yaxis" id="yaxis" onchange="updatePlot()">
<option value="semimajoraxis">Semi-major axis [AU]</option>
<option selected="selected" value="mass">Mass [MJup]</option>
<option value="radius">Radius [RJup]</option>
<option value="eccentricity">Eccentricity</option>
<option value="period">Period [days]</option>
<option value="temperature">Temperature [K]</option>
<option value="inclination">Inclination [deg]</option>
<option value="discoveryyear">Discoveryyear</option>
<option value="numberofplanetsinsystem">Number of planets in system</option>
<option value="numberofstarsinsystem">Number of stars in system</option>
<option value="declination">Declination [deg]</option>
<option value="rightascension">Right ascension [h]</option>
<option value="distance">Distance from Earth [pc]</option>
<option value="age">Stellar age [Gyrs]</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="logscaley"><input checked="checked" name="logscale" type="checkbox" value="y" id="logscaley" onclick="updatePlot()"/>Logarithmic scale</label>
</td>
</tr>
<tr>
<td>
<label for="yrangeauto"><input checked="checked" name="yrangeauto" type="checkbox" value="a" id="yrangeauto" onclick="yrangeUpdate()"/>Automatic range</label>
</td>
</tr>
<tr>
<td id="yrangerow" style="display:none;">
range = [<input type="text" name="yrangel" size="8" value="0" onkeyup="yrangeUpdate()"/>,
<input type="text" name="yranger" size="8" value="0" onkeyup="yrangeUpdate()"/>]
</td>
</tr>
<tr>
<th rowspan="4" scope="row">
<label>Color</label>
</th>
<td>
<select name="coloraxis" id="coloraxis" onchange="updatePlot();colorrangeUpdate();">
<option value="none">Constant</option>
<option value="discoverymethod">Discoverymethod</option>
<option value="semimajoraxis">Semi-major axis [AU]</option>
<option value="mass">Mass [MJup]</option>
<option selected="selected" value="radius">Radius [RJup]</option>
<option value="eccentricity">Eccentricity</option>
<option value="period">Period [days]</option>
<option value="temperature">Temperature [K]</option>
<option value="inclination">Inclination [deg]</option>
<option value="discoveryyear">Discoveryyear</option>
<option value="numberofplanetsinsystem">Number of planets in system</option>
<option value="numberofstarsinsystem">Number of stars in system</option>
<option value="declination">Declination [deg]</option>
<option value="rightascension">Right ascension [h]</option>
<option value="distance">Distance from Earth [pc]</option>
<option value="age">Stellar age [Gyrs]</option>
</select>
</td>
</tr>
<tr>
<td id="logscalecolorrow">
<label for="logscalecolor"><input name="logscalecolor" type="checkbox" value="color" id="logscalecolor" onclick="updatePlot()"/>Logarithmic scale</label>
</td>
</tr>
<tr>
<td id="colorrangeautorow">
<label for="colorrangeauto"><input checked="checked" name="colorrangeauto" type="checkbox" value="a" id="colorrangeauto" onclick="colorrangeUpdate()"/>Automatic range</label>
</td>
</tr>
<tr>
<td id="colorrangerow" style="display:none;">
range = [<input type="text" name="colorrangel" size="8" value="0" onkeyup="colorrangeUpdate()"/>,
<input type="text" name="colorranger" size="8" value="0" onkeyup="colorrangeUpdate()"/>]
</td>
</tr>
<tr>
<th rowspan="5" scope="row">
<label>Point size</label>
</th>
<td>
<select name="sizeaxis" id="sizeaxis" onchange="updatePlot();sizerangeUpdate();">
<option selected="selected" value="none">Constant</option>
<option value="semimajoraxis">Semi-major axis [AU]</option>
<option value="mass">Mass [MJup]</option>
<option value="radius">Radius [RJup]</option>
<option value="eccentricity">Eccentricity</option>
<option value="period">Period [days]</option>
<option value="temperature">Temperature [K]</option>
<option value="inclination">Inclination [deg]</option>
<option value="discoveryyear">Discoveryyear</option>
<option value="numberofplanetsinsystem">Number of planets in system</option>
<option value="numberofstarsinsystem">Number of stars in system</option>
<option value="declination">Declination [deg]</option>
<option value="rightascension">Right ascension [h]</option>
<option value="distance">Distance from Earth [pc]</option>
</select>
</td>
</tr>
<tr>
<td id="logscalesizerow" style="display:none;">
<label for="logscalesize"><input name="logscalesize" type="checkbox" value="size" id="logscalesize" onclick="updatePlot()"/>Logarithmic scale</label>
</td>
</tr>
<tr>
<td id="sizerangeautorow" style="display:none;">
<label for="sizerangeauto"><input checked="checked" name="sizerangeauto" type="checkbox" value="a" id="sizerangeauto" onclick="sizerangeUpdate()"/>Automatic range</label>
</td>
</tr>
<tr>
<td id="sizerangerow" style="display:none;">
range = [<input type="text" name="sizerangel" size="8" value="0" onkeyup="sizerangeUpdate()"/>,
<input type="text" name="sizeranger" size="8" value="0" onkeyup="sizerangeUpdate()"/>]
</td>
</tr>
<tr>
<td>
<label for="sizemax">Maximum point size = <input type="text" name="sizemax" id="sizemax" size="3" value="4" onkeyup="sizerangeUpdate()"/></label>
</td>
</tr>
<tr>
<th rowspan="6" scope="row">
Detection methods
</th>
<td>
<label for="filter_transit"><input checked="checked" name="discoveryfilter" type="checkbox" value="transit" id="filter_transit" onclick="updatePlot()"/>Transiting planets</label>
</td>
</tr>
<tr>
<td>
<label for="filter_rv"><input checked="checked" name="discoveryfilter" type="checkbox" value="RV" id="filter_rv" onclick="updatePlot()"/>Radial velocity planets</label>
</td>
</tr>
<tr>
<td>
<label for="filter_microlensing"><input checked="checked" name="discoveryfilter" type="checkbox" value="microlensing" id="filter_microlensing" onclick="updatePlot()"/>Microlensing planets</label>
</td>
</tr>
<tr>
<td>
<label for="filter_imaged"><input checked="checked" name="discoveryfilter" type="checkbox" value="imaging" id="filter_imaged" onclick="updatePlot()"/>Directly imaged planets</label>
</td>
</tr>
<tr>
<td>
<label for="filter_timing"><input checked="checked" name="discoveryfilter" type="checkbox" value="timing" id="filter_timing" onclick="updatePlot()"/>Planets found by pulsar timing</label>
</td>
</tr>
<tr>
<td>
<label for="filter_other"><input checked="checked" name="discoveryfilter" type="checkbox" value="" id="filter_other" onclick="updatePlot()"/>Planets found by other methods</label>
</td>
</tr>
<tr>
<th rowspan="3" scope="row">
Stellar multiplicity
</th>
<td>
<label for="stellarmultiplicity_all"><input checked="checked" name="stellarmultiplicity" type="radio" value="all" id="stellarmultiplicity_all" onclick="updatePlot()"/>All planets</label>
</td>
</tr>
<tr>
<td>
<label for="stellarmultiplicity_ptype"><input name="stellarmultiplicity" type="radio" value="ptype" id="stellarmultiplicity_circumbinary" onclick="updatePlot()"/>Only circumbinary planets, P-type</label>
</td>
</tr>
<tr>
<td>
<label for="stellarmultiplicity_stype"><input name="stellarmultiplicity" type="radio" value="stype" id="stellarmultiplicity_stype" onclick="updatePlot()"/>Only planets around stars with<br />a wide binary companion, S-type</label>
</td>
</tr>
<tr>
<th rowspan="1" scope="row">
Export
</th>
<td>
<input type="button" onclick="saveaspng()" value="Save plot as png file" />
</td>
</tr>
</tbody>
</table>
<!-- ########################### -->
<script type="text/javascript">
// This specifies the data source.
// github is fast and reliable. The file in this repository is always up-to-date.
// github uses gzip compression which reduces the size of the entire database to only 100KB.
// However, your browser must allow script to be loaded from other websites.
//var source = "https://raw.github.com/hannorein/oec_iphone/master/data_iphone_9.1/systems.xml";
// You can always load a file in the same directory. This also works with local files if you do
// not have access to the internet.
var source = "systems.xml";
// Load data and update plot for the first time.
var xmldata = null;
d3.xml(source, "application/xml", function(xml) {
xmldata = xml;
updatePlot(true);
});
// Function returning the value specified by key for a given planet
function getValueForPlanetAndKey(planet,key,returnhtml){
returnhtml = (typeof returnhtml === "undefined") ? false : returnhtml;
switch (key){
case "numberofplanetsinsystem":
var system = $(planet).parents("system");
return system.find("planet").length;
case "numberofstarsinsystem":
var system = $(planet).parents("system");
return system.find("star").length;
case "declination":
case "rightascension":
var system = $(planet).parents("system");
var vals = $(key,system).text().split(" ");
return parseFloat(vals[0]) + parseFloat(vals[1])/60. + parseFloat(vals[2])/3600.;
case "distance":
var system = $(planet).parents("system");
return parseFloat($(key,system).text());
case "age":
var star = $(planet).parents("star");
return parseFloat($(key,star).text());
default:
if (returnhtml){
return getFormatForTag($(key,planet));
}else{
return parseFloat($(key,planet).text());
}
}
}
// Function to save the svg data (vector graphic) as a png file (bitmap).
// It draws the content to an HTML5 canvas and then redirects the bowser to a data url.
function saveaspng(){
d3.select("body").append("canvas")
.attr("width",width)
.attr("height",height)
.attr("id","canvas")
.style("display","none")
;
canvg('canvas', $("#viz").html());
window.location = document.getElementById("canvas").toDataURL("image/png");
}
// *** Setting up the SVG ***
var width = 600;
var height = 500;
var paddingt = 10;
var paddingb = 35;
var paddingl = 65;
var paddingr = 10;
var viz = d3.select("#viz")
.append("svg")
.attr("width", width)
.attr("height", height)
;
// *** Setup Axis ***
var gxaxis = viz.append("g")
.attr("transform", "translate(0," + (height - paddingb-paddingt) + ")");
;
var gyaxis = viz.append("g")
.attr("transform", "translate(" + paddingl + ", 0)")
;
var gxaxislabel = viz.append("text")
.attr("text-anchor", "middle")
.attr("x", width/2.)
.attr("y", height - 6)
;
var gyaxislabel = viz.append("text")
.attr("text-anchor", "middle")
.attr("x", -height/2.)
.attr("y", 12)
.attr("transform", "rotate(-90)")
;
// *** Setup Domains ***
var xDomain;
var yDomain;
var colorDomain;
var sizeDomain;
var sizemax;
function xrangeUpdate(){
if($("#xrangeauto").is(":checked")){
$("#xrangerow").hide();
updatePlot();
}else{
$("#xrangerow").show();
var xrangel = $("input[name=xrangel]").val();
var xranger = $("input[name=xranger]").val();
if (xrangel!=xDomain[0] || xranger!=xDomain[1]){
xDomain = [xrangel,xranger];
updatePlot();
}
}
}
function yrangeUpdate(){
if($("#yrangeauto").is(":checked")){
$("#yrangerow").hide();
updatePlot();
}else{
$("#yrangerow").show();
var yrangel = $("input[name=yrangel]").val();
var yranger = $("input[name=yranger]").val();
if (yrangel!=yDomain[0] || yranger!=yDomain[1]){
yDomain = [yrangel,yranger];
updatePlot();
}
}
}
function colorrangeUpdate(){
if(colorkey=="none"){
$("#colorrangeautorow").hide();
$("#logscalecolorrow").hide();
}else{
$("#colorrangeautorow").show();
$("#logscalecolorrow").show();
}
if(d3.select("#colorrangeauto").node().checked){
$("#colorrangerow").hide();
updatePlot();
}else{
$("#colorrangerow").show();
var newcolorDomain = [ parseFloat(d3.select("[name=colorrangel]").node().value), parseFloat(d3.select("[name=colorranger]").node().value) ];
if (newcolorDomain[0]!=colorDomain[0] || newcolorDomain[1]!=colorDomain[1]){
colorDomain = newcolorDomain;
updatePlot();
}
}
}
function sizerangeUpdate(){
if(sizekey=="none"){
$("#sizerangeautorow").hide();
$("#logscalesizerow").hide();
}else{
$("#sizerangeautorow").show();
$("#logscalesizerow").show();
}
if(d3.select("#sizerangeauto").node().checked){
$("#sizerangerow").hide();
updatePlot();
}else{
$("#sizerangerow").show();
var newsizeDomain = [ parseFloat(d3.select("[name=sizerangel]").node().value), parseFloat(d3.select("[name=sizeranger]").node().value) ];
var newsizemax = parseFloat($("#sizemax").val());
if (newsizeDomain[0]!=sizeDomain[0] || newsizeDomain[1]!=sizeDomain[1] || newsizemax!=sizemax){
sizeDomain = newsizeDomain;
updatePlot();
}
}
}
var colorkey;
var colorScale;
var sizekey;
var sizeScale;
var logscalesize;
var logscalecolor;
var i = 0;
function getColor(planet){
switch (colorkey){
case "discoverymethod":
var text = $(colorkey,planet).text();
if (text=="RV") return "red";
if (text=="transit") return "green";
if (text=="imaging") return "blue";
if (text=="timing") return "yellow";
if (text=="microlensing") return "purple";
return "gray";
default:
var val = getValueForPlanetAndKey(planet,colorkey);
if (isNaN(val)) return "gray";
if (logscalecolor && val<=0.) return "#eee";
return d3.hsl(120.-colorScale(val), 1, 0.5);
}
}
function getSize(planet){
switch (sizekey){
case "none":
return sizemax; // will set all points sizes to sizemax
default:
var val = getValueForPlanetAndKey(planet,sizekey);
if (isNaN(val)) return 0;
return sizeScale(val);
}
}
var updatePlot = function(first){
var discoveryfilter = d3.selectAll("input[name=discoveryfilter]:checked");
var stellarmultiplicity = $("input:radio[name=stellarmultiplicity]:checked").val();
var xkey = $("#xaxis option:selected").val();
var ykey = $("#yaxis option:selected").val();
colorkey = $("#coloraxis option:selected").val();
sizekey = $("#sizeaxis option:selected").val();
var xlabel = $("#xaxis option:selected").text();
var ylabel = $("#yaxis option:selected").text();
var colorlabel = $("#coloraxis option:selected").text();
var sizelabel = $("#sizeaxis option:selected").text();
var logscalex = $("#logscalex").is(":checked");
var logscaley = $("#logscaley").is(":checked");
logscalecolor = $("#logscalecolor").is(":checked");
logscalesize = $("#logscalesize").is(":checked");
sizemax = parseFloat($("#sizemax").val());
var planets;
switch(stellarmultiplicity){
case "all":
planets = $("planet",xmldata);
break;
case "ptype":
planets = $("binary > planet",xmldata);
break;
case "stype":
planets = $("binary > star > planet",xmldata);
break;
}
var planetsCache = Array();
var planetsFilteredN = 0;
var planetsFiltered = jQuery.grep(planets,function(d,i) {
var discoverymethod = $("discoverymethod",d).text();
var isInSelection = false;
discoveryfilter[0].forEach(function(d){
if(d.value==discoverymethod){
isInSelection = true;
}
});
if (!isInSelection){
return false;
}
var valx = getValueForPlanetAndKey(d,xkey);
if(isNaN(valx)) return false;
if(logscalex && valx<=0.) return false;
var valy = getValueForPlanetAndKey(d,ykey);
if(isNaN(valy)) return false;
if(logscaley && valy<=0.) return false;
planetsCache[planetsFilteredN] = [valx,valy];
planetsFilteredN = planetsFilteredN + 1;
return true;
});
if($("#xrangeauto").is(":checked")){
xDomain = d3.extent(planetsFiltered, function(d,i) {
return planetsCache[i][0];
});
$("input[name=xrangel]").val(xDomain[0]);
$("input[name=xranger]").val(xDomain[1]);
}
if($("#yrangeauto").is(":checked")){
yDomain = d3.extent(planetsFiltered, function(d,i) {
return planetsCache[i][1];
});
$("input[name=yrangel]").val(yDomain[0]);
$("input[name=yranger]").val(yDomain[1]);
}
if(d3.select("#colorrangeauto").node().checked){
colorDomain = d3.extent(planetsFiltered, function(d) {
return getValueForPlanetAndKey(d,colorkey);
});
d3.select("[name=colorrangel]").node().value = colorDomain[0];
d3.select("[name=colorranger]").node().value = colorDomain[1];
}
if(d3.select("#sizerangeauto").node().checked){
sizeDomain = d3.extent(planetsFiltered, function(d) {
return getValueForPlanetAndKey(d,sizekey);
});
d3.select("[name=sizerangel]").node().value = sizeDomain[0];
d3.select("[name=sizeranger]").node().value = sizeDomain[1];
}
var xScale;
if (logscalex){
xScale = d3.scale.log();
}else{
xScale = d3.scale.linear();
}
xScale.domain(xDomain)
.clamp(true)
.range([paddingl, width-paddingl-paddingr]);
var yScale;
if (logscaley){
yScale = d3.scale.log();
}else{
yScale = d3.scale.linear();
}
yScale.domain(yDomain)
.clamp(true)
.range([height - paddingb-paddingt,paddingt]);
if (logscalecolor){
colorScale = d3.scale.log();
}else{
colorScale = d3.scale.linear();
}
colorScale.domain(colorDomain)
.clamp(true)
.range([0,120]);
if (logscalesize){
sizeScale = d3.scale.log();
}else{
sizeScale = d3.scale.linear();
}
sizeScale.domain(sizeDomain)
.clamp(true)
.range([0,sizemax]);
var circle = viz.selectAll("circle")
.data(planetsFiltered,function(d) {return $("name:first",d).text(); });
circle.enter().append("circle")
.attr("cx", function(d,i) { return xScale(planetsCache[i][0]); })
.attr("cy", function(d,i) { return yScale(planetsCache[i][1]); })
.attr("r", function(d) { return getSize(d); })
.style("fill", function(d) { return getColor(d); })
.style("stroke", "black")
.style("opacity",(first?1:0))
.on("click", function(d) {
document.location.href = "/system.html?id=" + $(d.getElementsByTagName("name")[0]).text();
})
.on("mouseout", function(d){
d3.select("#pop-up").style("display","none");
})
.on("mousemove", function(){
d3.select("#pop-up").style("top", (event.pageY-10)+"px").style("left",(event.pageX+10)+"px");
})
;
circle
.on("mouseover", function(d){
var name = $(d.getElementsByTagName("name")[0]).text();
var description = $(d.getElementsByTagName("description")[0]).text();
d3.select("#pop-up").style("display","inline");
d3.select("#pop-up-title").html(name);
if (description){
d3.select("#pop-up-description").html(description);
}else{
d3.select("#pop-up-description").html("");
}
var values = "";
values += "<span class=\"popupvalue\">" + xlabel + ":</span>" + getValueForPlanetAndKey(d,xkey,true)
+ "<br /><span class=\"popupvalue\">" + ylabel + ":</span>" + getValueForPlanetAndKey(d,ykey,true);
if (colorkey!="none"){
values += "<br /><span class=\"popupvalue\">" + colorlabel + ":</span>" + getValueForPlanetAndKey(d,colorkey,true);
}
if (sizekey!="none"){
values += "<br /><span class=\"popupvalue\">" + sizelabel + ":</span>" + getValueForPlanetAndKey(d,sizekey,true);
}
$("#pop-up-values").html(values);
})
.transition()
.duration( (first?0:500) )
.attr("cx", function(d,i) { return xScale(planetsCache[i][0]); })
.attr("cy", function(d,i) { return yScale(planetsCache[i][1]); })
.attr("r", function(d) { return getSize(d); })
.style("fill", function(d) { return getColor(d); })
.style("opacity",1)
;
circle.exit()
.transition()
.style("opacity",0)
.remove();
var xAxis = d3.svg.axis()
.scale(xScale)
.ticks(5)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(yScale)
.ticks(5)
.orient("left");
if (first){
gxaxis.call(xAxis);
gyaxis.call(yAxis);
}else{
gxaxis.transition().call(xAxis);
gyaxis.transition().call(yAxis);
}
gxaxis.selectAll("path,line")
.style("fill","none")
.style("stroke","black");
gyaxis.selectAll("path,line")
.style("fill","none")
.style("stroke","black");
gxaxislabel.text(xlabel);
gyaxislabel.text(ylabel);
};
</script>
<div class="spacer" style="clear:left"></div>
<!-- ########################### -->
<h2><img src="./img/xml.png" alt="star" />Data download</h2>
<p>
The data presented in this plot is taken from the <a href="https://github.com/hannorein/open_exoplanet_catalogue">Open Exoplanet Catalogue</a>. All information on this page is directly generated from the XML files in the catalogue. If you are interested in how, look at the source code. You can download the entire catalogue on <a href="https://github.com/hannorein/open_exoplanet_catalogue/">github</a>. You can also find ASCII tables of the same catalogue <a href="https://github.com/hannorein/oec_tables/">in a separate repository</a>. Some information, especially in the case of a binary system cannot be easily represented in an ASCII table. You are therefore encouraged to use the original XML files provided by the Open Exoplanet Catalogue.
</p>
<!-- If run on a server, you can include your own footer -->
<script language="php"> include "./.inc/footer.php"; if (false){ </script>
<!-- ** start server side header ** -->
</div> <!-- content -->
<div class="clearer"> </div>
<div class="footer">
The data on this page is taken from the <a href="http://github.com/hannorein/open_exoplanet_catalogue">Open Exoplanet Catalogue</a>. The Open Exoplanet Catalogue as well as this website itself are licensed under an <a href="https://github.com/hannorein/open_exoplanet_catalogue/blob/master/README.md">MIT license</a>.
</div> <!-- footer -->
</div> <!-- inner container -->
</div> <!-- outer container -->
</body>
</html>
<!-- ** end server side header ** -->
<script language="php"> } </script>