Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tovare/a9e259a57d8f36d142f9 to your computer and use it in GitHub Desktop.
Save tovare/a9e259a57d8f36d142f9 to your computer and use it in GitHub Desktop.
Module2: Number of Cash for Care reciptients by year and sex.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Excercise module 2</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
</head>
<body>
<svg width="410" height="410">
</svg>
<script type="text/javascript">
function drawFigure() {
var fig = d3.select("svg");
fig.append("circle")
.attr("cx",205).attr("cy",205).attr("r",200)
.attr("stroke","black").attr("stroke-width",3).attr("fill","white");
fig.append("ellipse").attr("cx",100).attr("cy",200).attr("rx",40).attr("ry",80)
.attr("stroke","black").attr("stroke-width",3).attr("fill","yellow");
fig.append("ellipse").attr("cx",300).attr("cy",200).attr("rx",40).attr("ry",80)
.attr("stroke","black").attr("stroke-width",3).attr("fill","yellow");
fig.append("circle")
.attr("cx",100).attr("cy",220).attr("r",20)
.attr("stroke","black").attr("stroke-width",3).attr("fill","white");
fig.append("circle")
.attr("cx",300).attr("cy",220).attr("r",20)
.attr("stroke","black").attr("stroke-width",3).attr("fill","white");
}
//Load in contents of CSV file
d3.csv("Number of Cash for Care recipients by year and sex.csv", function(data) {
drawFigure();
console.log(data);
});
</script>
</body>
</html>
Category 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
Sum 64278 53497 45528 38753 34781 32108 30140 15785 16207 16199
24 or younger 6509 5437 4633 4001 3627 3295 3116 1595 1590 1393
25-29 16804 14145 12016 10141 8934 8330 7601 4218 4280 4243
30-34 22509 18240 14917 12181 10875 9967 9355 4863 5162 5346
35-39 13797 11513 10120 8755 7808 7182 6668 3501 3473 3480
40-44 3999 3561 3209 3055 2869 2634 2663 1236 1324 1356
over 45 660 601 633 620 668 700 737 372 378 381
Men 3544 3525 3657 3983 4289 4596 4893 2691 2987 3546
Men 24 og younger 97 106 102 115 107 109 91 67 58 74
Men 25-29 456 475 518 595 733 776 781 445 514 564
Men 30-34 1073 1089 1116 1194 1311 1450 1496 824 924 1216
Men 35-39 1018 989 996 1056 1042 1187 1317 716 753 904
Men 40-44 554 550 553 628 682 609 693 367 451 495
Men over 45 346 316 372 395 414 465 515 272 287 293
Women 60734 49972 41871 34770 30492 27512 25247 13094 13220 12653
Women 24 og younger 6412 5331 4531 3886 3520 3186 3025 1528 1532 1319
Women 25-29 16348 13670 11498 9546 8201 7554 6820 3773 3766 3679
Women 30-34 21436 17151 13801 10987 9564 8517 7859 4039 4238 4130
Women 35-39 12779 10524 9124 7699 6766 5995 5351 2785 2720 2576
Women 40-44 3445 3011 2656 2427 2187 2025 1970 869 873 861
Women over 45 314 285 261 225 254 235 222 100 91 88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment