Skip to content

Instantly share code, notes, and snippets.

View yan2014's full-sized avatar

Joan yan2014

View GitHub Profile
@yan2014
yan2014 / index.html
Last active October 22, 2015 16:08
Week 4: SVG fixes
<html lang="en">
<head>
<meta charset="utf-8">
<title>SVG Shapes</title>
<link rel="stylesheet" type="text/css" href="main.css"> </head>
</head>
<body>
<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@yan2014
yan2014 / index.html
Last active October 22, 2015 16:13
Week4: Heatmap table
<!--Make a table like the one in d3_table_heatmap.html for your data. It should be sortable using stupidtable.js. Make a color scale for one of your numeric columns. You can use the scale on a font or the background. Same rules as above:
Week4: Heatmap table
Style it (with CSS or in d3).
Make the column names nice ones for people to read in the table.
Sort the data in javascript for a default sort order that's sensible.
Make sure the headers have a cursor that looks like it's a pointer, that indicates you can click.
Be sure to add text identifying source and explaining the data.
Send me the gist: "Week4: Heatmap table"-->
<!--http://data.unicef.org/education/overview.html-->
<!DOCTYPE html>
@yan2014
yan2014 / index.html
Last active October 22, 2015 17:34
Week 3: Basic D3 Table
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Loading CSV Data with D3</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<h1>Eastern Asia Improved the Most</h1>
<p>This table shows regional access to improved water over 15 years. </p>
@yan2014
yan2014 / angular-route.min.js
Last active October 22, 2015 17:49
Week 2: Another JS library
/*
AngularJS v1.2.1
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
(function(v,c,B){'use strict';function y(t,q,l,b,f){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(k,A,n,C,x){function w(){g&&(g.$destroy(),g=null);p&&(f.leave(p),p=null)}function d(){var a=t.current&&t.current.locals,e=a&&a.$template;if(e){var z=k.$new();x(z,function(u){u.html(e);f.enter(u,null,p||A,function(){!c.isDefined(r)||r&&!k.$eval(r)||q()});w();var h=l(u.contents()),m=t.current;g=m.scope=z;p=u;if(m.controller){a.$scope=g;var d=b(m.controller,a);m.controllerAs&&
(g[m.controllerAs]=d);u.data("$ngControllerController",d);u.children().data("$ngControllerController",d)}h(g);g.$emit("$viewContentLoaded");g.$eval(s)})}else w()}var g,p,r=n.autoscroll,s=n.onload||"";k.$on("$routeChangeSuccess",d);d()}}}v=c.module("ngRoute",["ng"]).provider("$route",function(){function t(b,f){return c.extend(new (c.extend(function(){},{prototype:b})),f)}function q(b,c){var k=c.caseInsensitiveMatch,l={origin
@yan2014
yan2014 / data.csv
Last active October 22, 2015 17:51
Week2: High Charts
row White African American
32-40 204130.93 61454.078
38-46 383043.64 122756.27
41-49 410386.43 99313.841
44-52 493450.35 109144.06
47-55 671449.03 137073.24
50-58 974449.18 171990.58
53-61 1155156.3 265305.89
56-64 1261739.3 249652.44
59-67 1203205 172400.03
@yan2014
yan2014 / index.html
Last active October 22, 2015 17:57
Week 8: Scatter Homework
<!DOCTYPE html>
<!-- Modified example from enjalot: http://bl.ocks.org/enjalot/1429426 -->
<html>
<head>
<title>Bar Transition Example</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<style type="text/css">
.selected {
border: 1px solid #0000ff;
@yan2014
yan2014 / deaths_04yearsold_2013percent.csv
Last active October 22, 2015 17:57
Week 8: Finished Bar Homework
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 11 columns, instead of 8. in line 7.
Country,Meningitis_encephalitis,Respiratory_infections,Sepsis,Pertussis,Malaria,Measles,Congenital_anomalies,HIV_AIDS,Diarrhoeal_diseases,Asphyxia_trauma
India,0.042488278,0.233534888,0.145938913,0.007182025,0.009314662,0.046933792,0.123114044,0.00663867,0.184781579,0.200073149
Democratic Republic of the Congo,0.040686134,0.221728479,0.075842245,0.01386753,0.212434283,0.06908283,0.048008834,0.02005919,0.150790387,0.147500089
Indonesia,0.025829262,0.27277861,0.106128312,0.01262,0.030445137,0.076689828,0.185003315,0.017677822,0.092133369,0.180694346
Pakistan,0.042190621,0.28618202,0.163435643,0.021985945,0.001921226,0.020857808,0.075568204,0.000843982,0.175454966,0.211559586
Nigeria,0.043200357,0.207813651,0.071262349,0.016492104,0.287175958,0.007996224,0.044873945,0.042612526,0.133019132,0.145553754
Ethiopia,0.034238059,0.262054587,0.115549659,0.028521607,0.043578469,0.034427597,0.081432904,0.034783927,0.140515542,0.22489765
Afghanistan,0.052876527,0.315089385,0.112120879,0.01908775,9.43381E-05,0.061885819,0.0
@yan2014
yan2014 / ECD.csv
Last active October 22, 2015 17:59
Week 7: Transition Plot With Button
country AMale AFemale ASMale ASFemale CMale CFemale
Afghanistan 1 1 74 73 42 39
Albania 39 42 85 87 14 11
Argentina 61 66 83 85 9 8
Belarus 86 89 94 97 4 4
Belize 30 34 88 83 3 2
Bhutan 10 10 52 57 13 15
Bosnia and Herzegovina 12 14 95 96 2 2
Cameroon 29 31 64 61 30 32
Central African Republic 5 6 74 74 60 62
@yan2014
yan2014 / index.html
Last active October 22, 2015 17:59
Week 7: Dots on Lines
<!DOCcountry html>
<head>
<meta charset="utf-8">
<style>
.graph .axis path {
fill: none;
stroke: #ccc;
shape-rendering: crispEdges;
}
@yan2014
yan2014 / co2_emissions.csv
Last active October 22, 2015 18:00
Week 6: Labeled Lines
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 54 columns, instead of 27. in line 2.
countryName,countryCode,indicatorName,indicatorCode,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
Afghanistan,AFG,CO2 emissions (kt),EN.ATM.CO2E.KT,491.378,689.396,707.731,839.743,1008.425,1092.766,1283.45,1224.778,942.419,1672.152,1895.839,1532.806,1639.149,1917.841,2126.86,1987.514,2390.884,2159.863,2240.537,1760.16,1983.847,2101.191,2522.896,2830.924,3509.319,3142.619,3124.284,2867.594,2775.919,2676.91,2493.56,1426.463,1375.125,1320.12,1268.782,1199.109,1114.768,1056.096,832.409,781.071,645.392,359.366,583.053,733.4,1015.759,1338.455,1991.181,3927.357,6523.593,8236.082
Albania,ALB,CO2 emissions (kt),EN.ATM.CO2E.KT,2280.874,2464.224,2082.856,2016.85,2174.531,2552.232,2680.577,3072.946,3245.295,3744.007,4352.729,5643.513,5291.481,4345.395,4594.751,4950.45,5720.52,6494.257,7587.023,5170.47,7341.334,7308.331,7