C1Task1PreD3Stage1
HTML
<div id ="container">
<div id ="header">
<h1>Demo Scatterplot</h1>
</div>
<div id ="sidebar">
</div>
<div id ="content">
<svg height="400" width="650">
</svg>
</div>
<div id ="footer">
</div>
</div>
CSS
h1 {
color: #ffffff;
font-family: 'Raleway';
font-weight: normal;
font-size: 1.75em;
letter-spacing: .2em;
line-height: 1.1em;
margin:0px;
text-align: center;
text-transform: uppercase;
}
#container {
width:800px;
}
#header {
width:800px;
height: 50px;
padding: 5px;
background: #1abc9c;
}
#sidebar {
height:400px;
width:150px;
background: #1abc9c;
float:left;
}
#content {
background-color:#ffffff;
height:400px;
width:650px;
float:left;
}
#footer {
width:800px;
height: 50px;
background: #1abc9c;
float:left;
}
circle {
stroke: #1abc9c;
stroke-width: 2;
fill: white;
}
JavaScript
circle_data = [{"x": 100,
"y": 300,
"r": 20},
{"x": 200,
"y": 250,
"r": 10},
{"x": 300,
"y": 180,
"r": 10}]
svg = d3.select("svg");
diag_circles = svg.selectAll("circle")
diag_circles.data(circle_data)
.enter()
.append("circle")
.attr("cx", function(d){return d.x})
.attr("cy", function(d){return d.y})
.attr("r", function(d){return d.r});