Last active
November 18, 2015 02:50
-
-
Save DimsumPanda/88aa1d70cd0c394feeae to your computer and use it in GitHub Desktop.
Week 11: Exploration - Africa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country | ISO3 | mortality | rateChange | |
---|---|---|---|---|
Angola | AGO | 156.9 | 0.305752212 | |
Chad | TCD | 138.7 | 0.353681267 | |
Somalia | SOM | 136.8 | 0.240843507 | |
Central African Republic | CAF | 130.1 | 0.262889518 | |
Sierra Leone | SLE | 120.4 | 0.544457056 | |
Mali | MLI | 114.7 | 0.54913522 | |
Nigeria | NGA | 108.8 | 0.488 | |
Benin | BEN | 99.5 | 0.445682451 | |
Congo, Dem. Rep. | COD | 98.3 | 0.472922252 | |
Niger | NER | 95.5 | 0.709018891 | |
Equatorial Guinea | GNQ | 94.1 | 0.503430079 | |
Guinea | GIN | 93.7 | 0.606633081 | |
Cote d'Ivoire | CIV | 92.6 | 0.393184797 | |
South Sudan | SSD | 92.6 | 0.634281201 | |
Guinea-Bissau | GNB | 92.5 | 0.596598343 | |
Afghanistan | AFG | 91.1 | 0.496685083 | |
Lesotho | LSO | 90.2 | -0.023836549 | |
Burkina Faso | BFA | 88.6 | 0.56181998 | |
Cameroon | CMR | 87.9 | 0.363043478 | |
Mauritania | MRT | 84.7 | 0.282811177 | |
Burundi | BDI | 81.7 | 0.524447031 | |
Pakistan | PAK | 81.1 | 0.414862915 | |
Mozambique | MOZ | 78.5 | 0.672507301 | |
Togo | TGO | 78.4 | 0.46374829 | |
Comoros | COM | 73.5 | 0.412470024 | |
Zimbabwe | ZWE | 70.7 | 0.067282322 | |
Sudan | SDN | 70.1 | 0.450196078 | |
Liberia | LBR | 69.9 | 0.725882353 | |
Haiti | HTI | 69 | 0.526748971 | |
Gambia, The | GMB | 68.9 | 0.595182139 | |
Lao PDR | LAO | 66.7 | 0.589285714 | |
Djibouti | DJI | 65.3 | 0.453098827 | |
Malawi | MWI | 64 | 0.735973597 | |
Zambia | ZMB | 64 | 0.664218258 | |
Ghana | GHA | 61.6 | 0.516483516 | |
Swaziland | SWZ | 60.7 | 0.187416332 | |
Ethiopia | ETH | 59.2 | 0.710654936 | |
Papua New Guinea | PNG | 57.3 | 0.359060403 | |
Kiribati | KIR | 55.9 | 0.417708333 | |
Uganda | UGA | 54.6 | 0.708177445 | |
Timor-Leste | TLS | 52.6 | 0.700626067 | |
Turkmenistan | TKM | 51.4 | 0.432044199 | |
Gabon | GAB | 50.8 | 0.453175457 | |
Myanmar | MMR | 50 | 0.545040946 | |
Madagascar | MDG | 49.6 | 0.691350342 | |
Kenya | KEN | 49.4 | 0.517106549 | |
Tanzania | TZA | 48.7 | 0.705205811 | |
India | IND | 47.7 | 0.620826709 | |
Sao Tome and Principe | STP | 47.3 | 0.572719061 | |
Senegal | SEN | 47.2 | 0.663817664 | |
Eritrea | ERI | 46.5 | 0.692866579 | |
Namibia | NAM | 45.4 | 0.382312925 | |
Congo, Rep. | COG | 45 | 0.519230769 | |
Tajikistan | TJK | 44.8 | 0.586715867 | |
Botswana | BWA | 43.6 | 0.195571956 | |
Yemen, Rep. | YEM | 41.9 | 0.668250198 | |
Rwanda | RWA | 41.7 | 0.725296443 | |
South Africa | ZAF | 40.5 | 0.323873122 | |
Guyana | GUY | 39.4 | 0.347682119 | |
Uzbekistan | UZB | 39.1 | 0.453146853 | |
Bolivia | BOL | 38.4 | 0.691318328 | |
Bangladesh | BGD | 37.6 | 0.738343772 | |
Marshall Islands | MHL | 36 | 0.284294235 | |
Nepal | NPL | 35.8 | 0.745557925 | |
Micronesia, Fed. Sts. | FSM | 34.7 | 0.375899281 | |
Bhutan | BTN | 32.9 | 0.753926702 | |
Iraq | IRQ | 32 | 0.408502773 | |
Azerbaijan | AZE | 31.7 | 0.665258712 | |
Dominican Republic | DOM | 30.9 | 0.486710963 | |
Guatemala | GTM | 29.1 | 0.640296663 | |
Cambodia | KHM | 28.7 | 0.755328218 | |
Solomon Islands | SLB | 28.1 | 0.292191436 | |
Philippines | PHL | 28 | 0.518900344 | |
Morocco | MAR | 27.6 | 0.655430712 | |
Vanuatu | VUT | 27.5 | 0.22752809 | |
Indonesia | IDN | 27.2 | 0.678866588 | |
Tuvalu | TUV | 27.1 | 0.526223776 | |
Algeria | DZA | 25.5 | 0.455128205 | |
Korea, Dem. Rep. | PRK | 24.9 | 0.426267281 | |
Cabo Verde | CPV | 24.5 | 0.609250399 | |
Egypt, Arab Rep. | EGY | 24 | 0.720605355 | |
Fiji | FJI | 22.4 | 0.248322148 | |
Mongolia | MNG | 22.4 | 0.792207792 | |
Nicaragua | NIC | 22.1 | 0.669656203 | |
Vietnam | VNM | 21.7 | 0.572834646 | |
Ecuador | ECU | 21.6 | 0.620386643 | |
Kyrgyz Republic | KGZ | 21.3 | 0.672307692 | |
Suriname | SUR | 21.3 | 0.552521008 | |
Dominica | DMA | 21.2 | -0.239766082 | |
West Bank and Gaza | PSE | 21.1 | 0.524774775 | |
Paraguay | PRY | 20.5 | 0.559139785 | |
Honduras | HND | 20.4 | 0.649484536 | |
Trinidad and Tobago | TTO | 20.4 | 0.331147541 | |
St. Vincent and the Grenadines | VCT | 18.3 | 0.253061224 | |
Jordan | JOR | 17.9 | 0.510928962 | |
Samoa | WSM | 17.5 | 0.435483871 | |
Panama | PAN | 17 | 0.449838188 | |
Peru | PER | 16.9 | 0.787954831 | |
El Salvador | SLV | 16.8 | 0.717171717 | |
Tonga | TON | 16.7 | 0.237442922 | |
Belize | BLZ | 16.5 | 0.583333333 | |
Brazil | BRA | 16.4 | 0.730263158 | |
Palau | PLW | 16.4 | 0.545706371 | |
Colombia | COL | 15.9 | 0.547008547 | |
Moldova | MDA | 15.8 | 0.52265861 | |
Jamaica | JAM | 15.7 | 0.486928105 | |
Iran, Islamic Rep. | IRN | 15.5 | 0.730434783 | |
Venezuela, RB | VEN | 14.9 | 0.496621622 | |
Saudi Arabia | SAU | 14.5 | 0.67268623 | |
St. Lucia | LCA | 14.3 | 0.367256637 | |
Armenia | ARM | 14.1 | 0.71686747 | |
Kazakhstan | KAZ | 14.1 | 0.731939163 | |
Albania | ALB | 14 | 0.655172414 | |
Tunisia | TUN | 14 | 0.754385965 | |
Seychelles | SYC | 13.6 | 0.175757576 | |
Mauritius | MUS | 13.5 | 0.415584416 | |
Turkey | TUR | 13.5 | 0.818791946 | |
Libya | LBY | 13.4 | 0.677884615 | |
Mexico | MEX | 13.2 | 0.716738197 | |
Barbados | BRB | 13 | 0.273743017 | |
Syrian Arab Republic | SYR | 12.9 | 0.653225806 | |
Argentina | ARG | 12.5 | 0.547101449 | |
Thailand | THA | 12.3 | 0.667567568 | |
Bahamas, The | BHS | 12.1 | 0.485106383 | |
Georgia | GEO | 11.9 | 0.750524109 | |
Grenada | GRD | 11.8 | 0.493562232 | |
Oman | OMN | 11.6 | 0.705583756 | |
Romania | ROU | 11.1 | 0.705570292 | |
China | CHN | 10.7 | 0.801115242 | |
St. Kitts and Nevis | KNA | 10.5 | 0.63028169 | |
Bulgaria | BGR | 10.4 | 0.529411765 | |
Brunei Darussalam | BRN | 10.2 | 0.163934426 | |
Uruguay | URY | 10.1 | 0.562770563 | |
Sri Lanka | LKA | 9.8 | 0.537735849 | |
Costa Rica | CRI | 9.7 | 0.426035503 | |
Russian Federation | RUS | 9.6 | 0.630769231 | |
Ukraine | UKR | 9 | 0.538461538 | |
Kuwait | KWT | 8.6 | 0.519553073 | |
Maldives | MDV | 8.6 | 0.908607864 | |
Lebanon | LBN | 8.3 | 0.744615385 | |
Antigua and Barbuda | ATG | 8.1 | 0.682352941 | |
Chile | CHL | 8.1 | 0.57591623 | |
Qatar | QAT | 8 | 0.615384615 | |
Latvia | LVA | 7.9 | 0.612745098 | |
Slovak Republic | SVK | 7.3 | 0.587570621 | |
Malaysia | MYS | 7 | 0.578313253 | |
United Arab Emirates | ARE | 6.8 | 0.587878788 | |
High income | HIC | 6.8 | 0.564102564 | |
Serbia | SRB | 6.7 | 0.764084507 | |
United States | USA | 6.5 | 0.419642857 | |
Malta | MLT | 6.4 | 0.433628319 | |
Bahrain | BHR | 6.2 | 0.730434783 | |
Hungary | HUN | 5.9 | 0.691099476 | |
New Zealand | NZL | 5.7 | 0.491071429 | |
Cuba | CUB | 5.5 | 0.586466165 | |
Macedonia, FYR | MKD | 5.5 | 0.849726776 | |
Bosnia and Herzegovina | BIH | 5.4 | 0.704918033 | |
Lithuania | LTU | 5.2 | 0.684848485 | |
Poland | POL | 5.2 | 0.699421965 | |
Canada | CAN | 4.9 | 0.409638554 | |
Montenegro | MNE | 4.7 | 0.71686747 | |
Belarus | BLR | 4.6 | 0.722891566 | |
Greece | GRC | 4.6 | 0.634920635 | |
France | FRA | 4.3 | 0.522222222 | |
Croatia | HRV | 4.3 | 0.666666667 | |
United Kingdom | GBR | 4.2 | 0.548387097 | |
Belgium | BEL | 4.1 | 0.59 | |
Spain | ESP | 4.1 | 0.627272727 | |
Israel | ISR | 4 | 0.655172414 | |
Switzerland | CHE | 3.9 | 0.524390244 | |
Australia | AUS | 3.8 | 0.586956522 | |
Netherlands | NLD | 3.8 | 0.542168675 | |
Germany | DEU | 3.7 | 0.564705882 | |
Ireland | IRL | 3.6 | 0.608695652 | |
Portugal | PRT | 3.6 | 0.755102041 | |
Austria | AUT | 3.5 | 0.631578947 | |
Denmark | DNK | 3.5 | 0.606741573 | |
Italy | ITA | 3.5 | 0.639175258 | |
Monaco | MCO | 3.5 | 0.551282051 | |
Czech Republic | CZE | 3.4 | 0.767123288 | |
Korea, Rep. | KOR | 3.4 | 0.521126761 | |
Sweden | SWE | 3 | 0.565217391 | |
Estonia | EST | 2.9 | 0.856435644 | |
San Marino | SMR | 2.9 | 0.733944954 | |
Andorra | AND | 2.8 | 0.670588235 | |
Cyprus | CYP | 2.7 | 0.756756757 | |
Japan | JPN | 2.7 | 0.571428571 | |
Singapore | SGP | 2.7 | 0.649350649 | |
Norway | NOR | 2.6 | 0.701149425 | |
Slovenia | SVN | 2.6 | 0.75 | |
Finland | FIN | 2.3 | 0.656716418 | |
Iceland | ISL | 2 | 0.6875 | |
Luxembourg | LUX | 1.9 | 0.784090909 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./legend");b.exports=function(){function a(a){var v=d.d3_calcType(c,t,j,k,o,r),w=a.append("g").attr("class",l+"legendCells"),x=w.selectAll("."+l+"cell").data(v.data),y=x.enter().append("g",".cell").attr("class",l+"cell").style("opacity",1e-6);shapeEnter=y.append(e).attr("class",l+"swatch"),shapes=x.select("g."+l+"cell "+e),d.d3_addEvents(y,u),x.exit().transition().style("opacity",0).remove(),d.d3_drawShapes(e,shapes,g,f,h,b),d.d3_addText(w,y,v.labels,l);var z=x.select("text"),A=shapes[0].map(function(a){return a.getBBox()});m?shapes.attr("class",function(a){return l+"swatch "+v.feature(a)}):"line"==e?shapes.style("stroke",v.feature):shapes.style("fill",v.feature);var B,C,D="start"==q?0:"middle"==q?.5:1;"vertical"===s?(B=function(a,b){return"translate(0, "+b*(A[b].height+i)+")"},C=function(a,b){return"translate("+(A[b].width+A[b].x+p)+","+(A[b].y+A[b].height/2+5)+")"}):"horizontal"===s&&(B=function(a,b){return"translate("+b*(A[b].width+i)+",0)"},C=function(a,b){return"translate("+(A[b].width*D+A[b].x)+","+(A[b].height+A[b].y+p+8)+")"}),d.d3_placement(s,x,B,z,C,q),d.d3_title(a,w,n,l),x.transition().style("opacity",1)}var b,c=d3.scale.linear(),e="rect",f=15,g=15,h=10,i=2,j=[5],k=[],l="",m=!1,n="",o=d3.format(".01f"),p=10,q="middle",r="to",s="vertical",t=!1,u=d3.dispatch("cellover","cellout","cellclick");return a.scale=function(b){return arguments.length?(c=b,a):a},a.cells=function(b){return arguments.length?((b.length>1||b>=2)&&(j=b),a):a},a.shape=function(c,d){return arguments.length?(("rect"==c||"circle"==c||"line"==c||"path"==c&&"string"==typeof d)&&(e=c,b=d),a):a},a.shapeWidth=function(b){return arguments.length?(f=+b,a):a},a.shapeHeight=function(b){return arguments.length?(g=+b,a):a},a.shapeRadius=function(b){return arguments.length?(h=+b,a):a},a.shapePadding=function(b){return arguments.length?(i=+b,a):a},a.labels=function(b){return arguments.length?(k=b,a):a},a.labelAlign=function(b){return arguments.length?(("start"==b||"end"==b||"middle"==b)&&(q=b),a):a},a.labelFormat=function(b){return arguments.length?(o=b,a):a},a.labelOffset=function(b){return arguments.length?(p=+b,a):a},a.labelDelimiter=function(b){return arguments.length?(r=b,a):a},a.useClass=function(b){return arguments.length?((b===!0||b===!1)&&(m=b),a):a},a.orient=function(b){return arguments.length?(b=b.toLowerCase(),("horizontal"==b||"vertical"==b)&&(s=b),a):a},a.ascending=function(b){return arguments.length?(t=!!b,a):a},a.classPrefix=function(b){return arguments.length?(l=b,a):a},a.title=function(b){return arguments.length?(n=b,a):a},d3.rebind(a,u,"on"),a}},{"./legend":2}],2:[function(a,b,c){b.exports={d3_identity:function(a){return a},d3_mergeLabels:function(a,b){if(0===b.length)return a;a=a?a:[];for(var c=b.length;c<a.length;c++)b.push(a[c]);return b},d3_linearLegend:function(a,b,c){var d=[];if(b.length>1)d=b;else for(var e=a.domain(),f=(e[e.length-1]-e[0])/(b-1),g=0;b>g;g++)d.push(e[0]+g*f);var h=d.map(c);return{data:d,labels:h,feature:function(b){return a(b)}}},d3_quantLegend:function(a,b,c){var d=a.range().map(function(d){var e=a.invertExtent(d);b(e[0]),b(e[1]);return b(e[0])+" "+c+" "+b(e[1])});return{data:a.range(),labels:d,feature:this.d3_identity}},d3_ordinalLegend:function(a){return{data:a.domain(),labels:a.domain(),feature:function(b){return a(b)}}},d3_drawShapes:function(a,b,c,d,e,f){"rect"===a?b.attr("height",c).attr("width",d):"circle"===a?b.attr("r",e):"line"===a?b.attr("x1",0).attr("x2",d).attr("y1",0).attr("y2",0):"path"===a&&b.attr("d",f)},d3_addText:function(a,b,c,d){b.append("text").attr("class",d+"label"),a.selectAll("g.cell text").data(c).text(this.d3_identity)},d3_calcType:function(a,b,c,d,e,f){var g=a.ticks?this.d3_linearLegend(a,c,e):a.invertExtent?this.d3_quantLegend(a,e,f):this.d3_ordinalLegend(a);return g.labels=this.d3_mergeLabels(g.labels,d),b&&(g.labels=this.d3_reverse(g.labels),g.data=this.d3_reverse(g.data)),g},d3_reverse:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b[c]=a[d-c-1];return b},d3_placement:function(a,b,c,d,e,f){b.attr("transform",c),d.attr("transform",e),"horizontal"===a&&d.style("text-anchor",f)},d3_addEvents:function(a,b){var c=this;a.on("mouseover.legend",function(a){c.d3_cellOver(b,a,this)}).on("mouseout.legend",function(a){c.d3_cellOut(b,a,this)}).on("click.legend",function(a){c.d3_cellClick(b,a,this)})},d3_cellOver:function(a,b,c){a.cellover.call(c,b)},d3_cellOut:function(a,b,c){a.cellout.call(c,b)},d3_cellClick:function(a,b,c){a.cellclick.call(c,b)},d3_title:function(a,b,c,d){if(""!==c){a.append("text").attr("class",d+"legendTitle").text(c);var e=a.select("."+d+"legendTitle").map(function(a){return a[0].getBBox().height})[0],f=-b.map(function(a){return a[0].getBBox().x})[0];b.attr("transform","translate("+f+","+(e+10)+")")}}}},{}],3:[function(a,b,c){var d=a("./legend");b.exports=function(){function a(a){var s=d.d3_calcType(c,q,h,i,l,o),t=a.append("g").attr("class",j+"legendCells"),u=t.selectAll("."+j+"cell").data(s.data),v=u.enter().append("g",".cell").attr("class",j+"cell").style("opacity",1e-6);shapeEnter=v.append(e).attr("class",j+"swatch"),shapes=u.select("g."+j+"cell "+e),d.d3_addEvents(v,r),u.exit().transition().style("opacity",0).remove(),"line"===e?(d.d3_drawShapes(e,shapes,0,f),shapes.attr("stroke-width",s.feature)):d.d3_drawShapes(e,shapes,s.feature,s.feature,s.feature,b),d.d3_addText(t,v,s.labels,j);var w,x,y=u.select("text"),z=shapes[0].map(function(a,b){var d=a.getBBox(),f=c(s.data[b]);return"line"===e&&"horizontal"===p?d.height=d.height+f:"line"===e&&"vertical"===p&&(d.width=d.width),d}),A=d3.max(z,function(a){return a.height+a.y}),B=d3.max(z,function(a){return a.width+a.x}),C="start"==n?0:"middle"==n?.5:1;"vertical"===p?(w=function(a,b){var c=d3.sum(z.slice(0,b+1),function(a){return a.height});return"translate(0, "+(c+b*g)+")"},x=function(a,b){return"translate("+(B+m)+","+(z[b].y+z[b].height/2+5)+")"}):"horizontal"===p&&(w=function(a,b){var c=d3.sum(z.slice(0,b+1),function(a){return a.width});return"translate("+(c+b*g)+",0)"},x=function(a,b){return"translate("+(z[b].width*C+z[b].x)+","+(A+m)+")"}),d.d3_placement(p,u,w,y,x,n),d.d3_title(a,t,k,j),u.transition().style("opacity",1)}var b,c=d3.scale.linear(),e="rect",f=15,g=2,h=[5],i=[],j="",k="",l=d3.format(".01f"),m=10,n="middle",o="to",p="vertical",q=!1,r=d3.dispatch("cellover","cellout","cellclick");return a.scale=function(b){return arguments.length?(c=b,a):a},a.cells=function(b){return arguments.length?((b.length>1||b>=2)&&(h=b),a):a},a.shape=function(c,d){return arguments.length?(("rect"==c||"circle"==c||"line"==c)&&(e=c,b=d),a):a},a.shapeWidth=function(b){return arguments.length?(f=+b,a):a},a.shapePadding=function(b){return arguments.length?(g=+b,a):a},a.labels=function(b){return arguments.length?(i=b,a):a},a.labelAlign=function(b){return arguments.length?(("start"==b||"end"==b||"middle"==b)&&(n=b),a):a},a.labelFormat=function(b){return arguments.length?(l=b,a):a},a.labelOffset=function(b){return arguments.length?(m=+b,a):a},a.labelDelimiter=function(b){return arguments.length?(o=b,a):a},a.orient=function(b){return arguments.length?(b=b.toLowerCase(),("horizontal"==b||"vertical"==b)&&(p=b),a):a},a.ascending=function(b){return arguments.length?(q=!!b,a):a},a.classPrefix=function(b){return arguments.length?(j=b,a):a},a.title=function(b){return arguments.length?(k=b,a):a},d3.rebind(a,r,"on"),a}},{"./legend":2}],4:[function(a,b,c){var d=a("./legend");b.exports=function(){function a(a){var t=d.d3_calcType(b,r,i,j,m,p),u=a.append("g").attr("class",k+"legendCells"),v=u.selectAll("."+k+"cell").data(t.data),w=v.enter().append("g",".cell").attr("class",k+"cell").style("opacity",1e-6);shapeEnter=w.append(c).attr("class",k+"swatch"),shapes=v.select("g."+k+"cell "+c),d.d3_addEvents(w,s),v.exit().transition().style("opacity",0).remove(),d.d3_drawShapes(c,shapes,f,e,g,t.feature),d.d3_addText(u,w,t.labels,k);var x,y,z=v.select("text"),A=shapes[0].map(function(a){return a.getBBox()}),B=d3.max(A,function(a){return a.height}),C=d3.max(A,function(a){return a.width}),D="start"==n?0:"middle"==n?.5:1;"vertical"===q?(x=function(a,b){return"translate(0, "+b*(B+h)+")"},y=function(a,b){return"translate("+(C+o)+","+(A[b].y+A[b].height/2+5)+")"}):"horizontal"===q&&(x=function(a,b){return"translate("+b*(C+h)+",0)"},y=function(a,b){return"translate("+(A[b].width*D+A[b].x)+","+(B+o)+")"}),d.d3_placement(q,v,x,z,y,n),d.d3_title(a,u,l,k),v.transition().style("opacity",1)}var b=d3.scale.linear(),c="path",e=15,f=15,g=10,h=5,i=[5],j=[],k="",l="",m=d3.format(".01f"),n="middle",o=10,p="to",q="vertical",r=!1,s=d3.dispatch("cellover","cellout","cellclick");return a.scale=function(c){return arguments.length?(b=c,a):a},a.cells=function(b){return arguments.length?((b.length>1||b>=2)&&(i=b),a):a},a.shapePadding=function(b){return arguments.length?(h=+b,a):a},a.labels=function(b){return arguments.length?(j=b,a):a},a.labelAlign=function(b){return arguments.length?(("start"==b||"end"==b||"middle"==b)&&(n=b),a):a},a.labelFormat=function(b){return arguments.length?(m=b,a):a},a.labelOffset=function(b){return arguments.length?(o=+b,a):a},a.labelDelimiter=function(b){return arguments.length?(p=b,a):a},a.orient=function(b){return arguments.length?(b=b.toLowerCase(),("horizontal"==b||"vertical"==b)&&(q=b),a):a},a.ascending=function(b){return arguments.length?(r=!!b,a):a},a.classPrefix=function(b){return arguments.length?(k=b,a):a},a.title=function(b){return arguments.length?(l=b,a):a},d3.rebind(a,s,"on"),a}},{"./legend":2}],5:[function(a,b,c){d3.legend={color:a("./color"),size:a("./size"),symbol:a("./symbol")}},{"./color":1,"./size":3,"./symbol":4}]},{},[5]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<style> | |
body { | |
font-family: Helvetica, sans-serif; | |
} | |
.countries { | |
stroke: #fff; | |
stroke-width:1px; | |
} | |
.legendLinear text { | |
font-size: 9px; | |
} | |
svg { | |
display: block; | |
margin: auto; | |
} | |
</style> | |
<body> | |
<h2>Under-Five Mortality Rates (per 1000 live births) in the World in 2015</h2> | |
<p>Compared to the rest of the world, Sub-Saharan Africa and South Asia experience the highest rates of mortality in the World.</p> | |
<p>Source: <a href="http://data.worldbank.org/indicator/SH.DYN.MORT">WHO</a>. Data shown is most recent data for countries with data available.</p> | |
<div id="vis"></div> | |
<script src="//d3js.org/d3.v3.min.js"></script> | |
<script src="//d3js.org/queue.v1.min.js"></script> | |
<script src="d3-legend.min.js"></script> | |
<script src="//d3js.org/topojson.v1.min.js"></script> | |
<script> | |
var width = 1000, | |
height = 600; | |
var svg = d3.select('#vis').append('svg') | |
.attr('width', width) | |
.attr('height', height); | |
var projection = d3.geo.mercator() | |
.scale(400) // mess with this if you want | |
.translate([width / 2, height / 2]); | |
var path = d3.geo.path() | |
.projection(projection); | |
//red,green | |
var colorScale = d3.scale.linear().range(["#C67171", "#00CD00"]).interpolate(d3.interpolateLab); | |
var countryById = d3.map(); | |
// we use queue because we have 2 data files to load. | |
queue() | |
.defer(d3.json, "africa.topojson") | |
.defer(d3.csv, "childMortality_2015.csv", typeAndSet) // process | |
.await(loaded); | |
function typeAndSet(d) { | |
d.rateChange = +d.rateChange; | |
countryById.set(d.ISO3, d); | |
return d; | |
} | |
function getColor(d) { | |
var dataRow = countryById.get(d.properties.iso_a3); | |
if (dataRow) { | |
console.log(dataRow); | |
return colorScale(dataRow.rateChange); | |
} else { | |
console.log("no dataRow", d); | |
return "#ccc"; | |
} | |
} | |
function getText(d) { | |
var dataRow = countryById.get(d.properties.iso_a3); | |
if (dataRow) { | |
console.log(dataRow); | |
return dataRow.country + ": " + dataRow.rateChange; | |
} else { | |
console.log("no dataRow", d); | |
return d.properties.nam + ": No data."; | |
} | |
} | |
function loaded(error, africa, malaria) { | |
console.log(africa); | |
console.log(malaria); | |
colorScale.domain(d3.extent(malaria, function(d) {return d.rateChange;})); | |
var countries = topojson.feature(africa, africa.objects.collection).features; | |
svg.selectAll('path.countries') | |
.data(countries) | |
.enter() | |
.append('path') | |
.attr('class', 'countries') | |
.attr('d', path) | |
.attr('fill', function(d,i) { | |
console.log(d.properties.name); | |
return getColor(d); | |
}) | |
.append("title") | |
.text(function(d) { | |
return getText(d); | |
}); | |
var linear = colorScale; | |
svg.append("g") | |
.attr("class", "legendLinear") | |
.attr("transform", "translate(20,20)"); | |
var legendLinear = d3.legend.color() | |
.shapeWidth(30) | |
.orient('horizontal') | |
.scale(linear); | |
svg.select(".legendLinear") | |
.call(legendLinear); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment