appendix-d
appendix D Exercise solutions
D.1 Solutions chapter 1
D.1.1 Build an SVG graphic
Listing D.1 Building an SVG graphic (index.html)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Exercise | D3.js in Action</title>
</head>
<body>
<div style="width:100%; max-width:400px; margin:0 auto;">
<svg viewBox="0 0 400 400" style="border:1px solid black;">
<rect x="100" y="100" width="200" height="200" fill="transparent"
stroke="black" stroke-width="5" />
<circle cx="200" cy="200" r="100" fill="plum" />
<line x1="100" y1="100" x2="300" y2="300" stroke="black"
stroke-width="5" />
<line x1="100" y1="300" x2="300" y2="100" stroke="black"
stroke-width="5" />
<text x="200" y="90" text-anchor="middle" style="font-size:18px;
font-family:sans-serif">SVG is awesome!</text>
</svg>
</div>
</body>
</html>