(function() {
'use strict';
var data = [
{
planet: 'Moon',
shuttle: null,
galileo:null,
ionA: null,
ionB: null,
solarSail: null,
poster: 0.134,
jet: null,
car: null,
x: 120,
y: 300,
r: 60
},
{
planet: 'Neptune',
shuttle: 11.4,
galileo: 5.9,
ionA: 4.9,
ionB: 0.490086, // 179d,
solarSail: 1.6,
poster: 1528,
jet: 495,
car: 4248,
x: 365,
y: 30,
r: 30
},
{
planet: 'Uranus',
shuttle: 7.3,
galileo: 3.8,
ionA: 3.1,
ionB: 0.309384,// 113d
solarSail: 1,
poster: 917,
jet: 310,
car: 2657,
x: 440,
y: 75,
r: 30
},
{
planet: 'Saturn',
shuttle: 3.6,
galileo: 1.8,
ionA: 1.5 ,
ionB: 0.150585, //55d
solarSail: 0.490086 ,//179d
poster: 425,
jet: 145,
car: 1244,
x: 570,
y: 75,
r: 60
},
{
planet: 'Nearest Star',
shuttle: null,
galileo: null,
ionA: null,
ionB: null,
solarSail: null,
poster: 425,
jet: null,
car: null,
x: 608,
y: 172,
r: 5
},
{
planet: 'Jupiter',
shuttle: 1.9,
galileo: 1,
ionA: 0.829587, //303d
ionB: 0.0848752, //31d
solarSail: 0.273791,//100d
poster: 209,
jet: 71,
car: 610,
x: 705,
y: 125,
r: 55
},
{
planet: 'Mars',
shuttle: 0.574961,//210d
galileo: 0.298432,//109d
ionA: 0.246412 ,//90d
ionB: 0.0246412,//9d
solarSail: 0.0793994,//29d
poster: 20,
jet: 8,
car: 71,
x: 600,
y: 300,
r: 35
},
{
planet: 'Pluto',
shuttle: 15.1,
galileo: 7.8,
ionA: 6.5 ,
ionB: 0.651622,//238d
solarSail: 2.1,
poster: 20,
jet: 657,
car: 5548,
x: 867,
y: 187,
r: 25
},
{
planet: 'Venus',
shuttle: 0.273791,//100d
galileo: 0.142371,//52d
ionA: 0.11773,//43d
ionB: 0.011773,//4.3d
solarSail: 0.011773,//14d
poster: 14,
jet: 6,
car: 46,
x: 650,
y: 418,
r: 40
},
{
planet: 'Sun',
shuttle: null,
galileo: null,
ionA: null,
ionB: null,
solarSail: null,
poster: 53,
jet: 18,
car: 152,
x: 845,
y: 410,
r: 75
},
{
planet: 'Mercury',
shuttle: 0.142371,//52d
galileo: 0.0739236,// 27d
ionA: 0.060234,//22d
ionB: 0.0060234,//2.2d
solarSail: 0.0199867,//7.3d
poster: 28,
jet: 11,
car: 95,
x: 930,
y: 503,
r: 30
}
]
console.log(data);
// vars
var svg = d3.select('svg'); // already added via the grid
svg.selectAll('circle')
.data(data)
.enter()
.append('circle')
.attr({
r: function(d) { return d.r },
cx: function(d) { return d.x },
cy: function(d) { return d.y }
})
.style({
fill: 'transparent',
stroke: 'none'
})
.on('mouseover', function(d, i) {
d3.select('header h1').text(d.planet);
d3.select('header p').html(
'Shuttle @ 28,000mph: ' + d.shuttle + '
' +
'Galileo @ 54,000mph: ' + d.galileo + '
' +
'Ion A @ 65,000mph: ' + d.ionA + '
' +
'Ion B @ 650,000mph: ' + d.ionB + '
' +
'Solar Sail @ 200,000mph: ' + d.solarSail + '
' +
'Poster time: ' + d.poster + '
' +
'Jet plane @ 600mph: ' + d.jet + '
' +
'By car @ 70mph: ' + d.car + '
'
);
});
})();