Skip to content

Instantly share code, notes, and snippets.

@lmelgar
Last active November 9, 2015 21:24
Show Gist options
  • Save lmelgar/d5972f3a4c7e19e5a6f6 to your computer and use it in GitHub Desktop.
Save lmelgar/d5972f3a4c7e19e5a6f6 to your computer and use it in GitHub Desktop.
"Week 11: Choropleth Map"

I think that tooltipsy dosen't work with the map because it only recognizes the svg area, not the countries' path. That could be an explanation to why the tooltip appears in the top of the svg.

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
!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]);
<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
body {
font-family: Helvetica, sans-serif;
padding: 40px;
}
.countries {
stroke: #fff;
stroke-width: 1px;
}
.legendLinear text {
font-size: 11px;
fill: white;
}
.tooltip{ background-color:rgba(255,255,255,0.8);
margin: 5px;
padding: 5px;
font-size: 13px;
}
/*.country-label {
fill: #777;
fill-opacity: .5;
font-size: 11px;
font-weight: 300;
text-anchor: middle;
}*/
</style>
<body>
<h2>Current Malaria infant mortality rates in Africa</h2>
<p>Per 1,000 live births</p>
<p>Source: <a href="http://data.unicef.org/child-health/diarrhoealdiseases.html">UNICEF</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="tooltip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="d3-legend.min.js"></script>
<script src="http://labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
var width = 700,
height = 600;
var svg = d3.select('#vis').append('svg')
.attr('width', width)
.attr('height', height)
.style("background-color", "#3E446B");
var projection = d3.geo.mercator()
.scale(380) // mess with this if you want
.translate([width / 2.4, height / 1.9]);
var path = d3.geo.path()
.projection(projection);
var colorScale = d3.scale.linear().range(["#FCE4C2", "#EB8A02"]).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, "my2013.csv", typeAndSet) // process
.await(loaded);
function typeAndSet(d) {
d.Malaria = +d.Malaria;
countryById.set(d.ISO3, d); //where the id in my2013
return d;
}
function getColor(d) {
var dataRow = countryById.get(d.properties.iso_a3); //match id my2013 with countries id
if (dataRow) {
console.log("row", dataRow);
return colorScale(dataRow.Malaria);
} 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 "<strong>" + dataRow.country + "</strong><br> The malaria rate in 2013 was <strong>" + dataRow.Malaria + "</strong>";
} else {
console.log("no dataRow", d);
return "<strong>" + d.properties.name + "</strong><br> No data";
}
}
function loaded(error, countries, illness) {
console.log("countries", countries);
console.log("illness", illness);
colorScale.domain(d3.extent(illness, function(d) {return d.Malaria;}));
var world = topojson.feature(countries, countries.objects.collection).features;
svg.selectAll('path.countries')
.data(world)
.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);
});*/
.call(d3.helper.tooltip(
function(d, i){
return getText(d);
}
)); //tooltip based in an example from Roger Veciana: http://bl.ocks.org/rveciana/5181105
var linear = colorScale;
svg.append("g")
.attr("class", "legendLinear")
.attr("transform", "translate(20,20)");
var legendLinear = d3.legend.color()
.shapeWidth(30)
.orient('vertical')
.scale(linear);
svg.select(".legendLinear")
.call(legendLinear);
}
</script>
</body>
</html>
country region ISO3 Diarrhoeal diseases HIV Pertussis Measles Meningitis and encephalitis Malaria Respiratory infections Prematurity Birth asphixia Sepsis and infections Perinatal and nutritional Congenital anomalies Injuries Other
Afghanistan South Asia AFG 13 0 1.2 3.9 3.3 0 19.8 12.3 10.9 7 9.9 3.5 6.8 5.8
Albania Europe & Central Asia ALB 0.1 0 0.1 0 0.4 0 1.5 2.9 1 0.5 1.2 4.2 1.4 1.4
Algeria Middle East & North Africa DZA 1.3 0.1 0.2 0.1 0.2 0 3.2 5 3.3 1.8 1.5 4.6 1.9 1.7
Andorra Europe & Central Asia AND 0 0 0 0 0 0 0.1 0.7 0.2 0.1 0.2 1 0.2 0.3
Angola Sub-Saharan Africa AGO 24.6 1.9 1 0.7 6 21.2 28.9 17.4 15.6 7.9 16.8 8.6 8.6 6.7
Antigua and Barbuda Latin America & Caribbean ATG 0.2 0 0 0 0 0 0.4 1.2 2.4 0 1.4 0.6 1.7 1.6
Argentina Latin America & Caribbean ARG 0.2 0 0.1 0 0.2 0 1.2 3.5 0.7 0.8 0.7 3.7 0.9 1.5
Armenia Europe & Central Asia ARM 0.2 0 0.1 0 0.3 0 1.5 3.9 1.3 0.8 1.4 4.2 1.2 1
Australia East Asia & Pacific AUS 0 0 0 0 0 0 0.1 0.9 0.5 0.1 0.5 1.1 0.3 0.5
Austria Europe & Central Asia AUT 0 0 0 0 0.1 0 0.1 0.8 0.4 0.1 0.3 1.5 0.1 0.5
Azerbaijan Europe & Central Asia AZE 2.4 0 0.2 0 0.4 0 5.2 7 3.7 1.8 2.1 4.5 2.8 3.6
Bahamas Latin America & Caribbean BHS 0 0 0 0 0 0 4.2 1.9 1 0.9 1 1.4 0.6 1.7
Bahrain Middle East & North Africa BHR 0 0 0 0 0.1 0 0.3 1 1.1 0.3 0.6 1.9 0.3 0.5
Bangladesh South Asia BGD 2.6 0 0.2 0.4 0.4 0.2 5.6 8.2 5.7 4.5 4.2 3.7 2.7 2.2
Barbados Latin America & Caribbean BRB 0 0 0 0 0 0 1.6 2 2.2 0.3 1 3.5 0.2 3.5
Belarus Europe & Central Asia BLR 0 0 0.1 0 0.1 0 0.3 1 0.3 0.1 0.2 1.9 0.4 0.5
Belgium Europe & Central Asia BEL 0 0 0 0 0.1 0 0.1 0.9 0.4 0.1 0.5 1.2 0.4 0.7
Belize Latin America & Caribbean BLZ 0.5 0.1 0 0 0.1 0 0.9 2.3 1.6 0.9 2.9 2.1 1.3 4
Benin Sub-Saharan Africa BEN 7.7 0.8 1.1 1.8 2 17.6 12.5 10.4 8.4 5 6.3 3.6 4.3 2.7
Bhutan South Asia BTN 2.6 0.1 0.2 0 0.4 0 5.8 6.7 4.4 2.9 3.2 3.8 3.4 2.4
Bolivia Latin America & Caribbean BOL 3.1 0.1 1.2 0 0.5 0 6.3 5.9 5.5 2.9 3 5 3.2 1.9
Bosnia and Herzegovina Europe & Central Asia BIH 0 0 0 0.1 0.1 0 0.4 2 0.6 0.3 0.3 1.9 0.3 0.5
Botswana Sub-Saharan Africa BWA 2.9 2.6 0.2 0.8 0.5 0 5.9 10.7 6.2 3.8 3.8 4.8 2.6 1.7
Brazil Latin America & Caribbean BRA 0.3 0 0 0 0.2 0 1 3 1.5 1.2 1.7 2.9 0.7 1.1
Brunei Darussalam East Asia & Pacific BRN 0.1 0 0.2 0 0.2 0 0.4 2.5 0.8 0.2 0.8 2.7 1.1 1.1
Bulgaria Europe & Central Asia BGR 0.1 0 0 0 0.2 0 1.9 2.9 1.3 0.2 0.6 3.2 0.5 0.8
Burkina Faso Sub-Saharan Africa BFA 9.6 0.6 1 1.5 2.4 21.8 14.5 10.6 8.5 5.3 7.5 4 5.2 3.6
Burundi Sub-Saharan Africa BDI 9.4 1.1 1 0.5 2 4.1 15 9.9 9.6 5.7 9.5 3.5 5.8 3
Côte d'Ivoire Sub-Saharan Africa CIV 9.4 2.3 1 0 2.3 15 14.4 13 12.4 7.1 8.2 4.2 4.7 2.5
Cabo Verde Sub-Saharan Africa CPV 1.4 0.8 0.2 0 0.4 0 3.8 4.8 2 1.4 2.8 4.7 0.9 2.6
Cambodia East Asia & Pacific KHM 2.8 0.1 1.1 0.7 0.5 0.2 6.2 5.9 4.9 2.9 3.4 3.7 3.1 1.7
Cameroon Sub-Saharan Africa CMR 10.6 2.7 1.1 0.3 2.6 11.6 15.9 10 10.5 5.3 7.9 4.8 5.6 4.4
Canada North America CAN 0 0 0 0 0 0 0.1 1.5 0.5 0.2 0.3 1.4 0.3 0.8
Central African Republic Sub-Saharan Africa CAF 12.9 4.3 1.3 0 4.9 35.2 20.5 14.9 15.2 5.9 9.6 3.3 5 3.1
Chad Sub-Saharan Africa TCD 17.9 2.8 1.4 0 6.2 27.6 25 16.2 12.1 5.3 14.1 3.8 7 4.2
Chile Latin America & Caribbean CHL 0 0 0 0 0.1 0 0.5 2.2 0.3 0.3 0.4 3 0.6 0.7
China East Asia & Pacific CHN 0.5 0 0.1 0 0.3 0 1.7 2 1.9 0.3 2 1.7 1.6 0.5
Colombia Latin America & Caribbean COL 0.3 0 0 0 0.2 0 1.5 3.9 1.4 1.3 2 4 1 1.3
Comoros Sub-Saharan Africa COM 6.8 0.8 1 0 1.5 11.5 11.8 11.4 9.5 6 6.4 3.7 4.1 2.3
Congo Sub-Saharan Africa COG 2.5 2.7 1.1 0 0.5 10.5 5.4 7.5 5.3 3.2 2.2 3.8 2.1 1.1
Costa Rica Latin America & Caribbean CRI 0.1 0 0.1 0 0.2 0 0.2 2.6 0.9 0.2 0.4 4 0.3 0.7
Croatia Europe & Central Asia HRV 0 0 0 0 0.2 0 0.1 0.7 0.3 0.2 1.1 1.2 0.1 0.6
Cuba Latin America & Caribbean CUB 0.1 0 0 0 0.2 0 0.7 0.9 0.7 0.4 0.4 1.3 0.5 1.2
Cyprus Europe & Central Asia CYP 0 0 0.1 0 0 0 0.1 0.8 0.3 0.1 0.1 1.3 0.2 0.6
Czech Republic Europe & Central Asia CZE 0 0 0 0 0.1 0 0.2 0.9 0.4 0.3 0.3 0.9 0.2 0.3
North Korea East Asia & Pacific PRK 1.5 0 0.1 0 0.4 0 4.5 6 2.9 1.6 2.6 3.6 2.1 1.8
Democratic Republic of the Congo Sub-Saharan Africa COD 12.3 1.6 1.1 5.6 3.3 17.4 18.1 14.8 12 6.2 10.4 3.9 5.8 3.2
Denmark Europe & Central Asia DNK 0 0 0 0 0 0 0 1.5 0.2 0 0.4 0.7 0.1 0.5
Djibouti Middle East & North Africa DJI 6.3 1.9 0.2 1.4 1.3 1.2 10.5 12.7 9.1 4.9 7.2 5.7 4.2 2.2
Dominica Latin America & Caribbean DMA 0 0 0 0 0 0 0.6 1.1 5.3 1.6 0.8 0.9 0 0.9
Dominican Republic Latin America & Caribbean DOM 1.4 0.2 0.2 0 0.3 0 3.6 6.8 3.5 2.1 1.6 4.7 2.4 1.4
Ecuador Latin America & Caribbean ECU 0.9 0 0.2 0 0.5 0 2.6 4.5 1.6 1 1.7 4.8 2.2 2.4
Egypt Middle East & North Africa EGY 1.1 0 0.2 0.1 0.1 0 2.3 6.2 2.8 0.6 1.3 4.5 0.8 1.5
El Salvador Latin America & Caribbean SLV 0.8 0.3 0.2 0 0.3 0 2 2.7 1.1 0.6 1.2 3.5 1.2 1.6
Equatorial Guinea Sub-Saharan Africa GNQ 7.7 7 1.4 0 3 14.3 14.6 13.7 10.6 5.5 5.4 3.6 4.1 3.2
Eritrea Sub-Saharan Africa ERI 5.1 0.3 1.1 1.3 1.1 0.2 9.7 4.8 6.1 3.7 5.4 4.1 4.4 2
Estonia Europe & Central Asia EST 0 0 0 0 0.2 0 0.2 0.3 0.3 0.4 0.1 0.9 0.7 0.4
Ethiopia Sub-Saharan Africa ETH 6 1.5 1.2 1.5 1.5 1.9 11.3 8 9.7 5 6.2 3.5 4.2 1.8
Fiji East Asia & Pacific FJI 1.1 0 0.2 0 0.8 0 3.1 4.4 1.7 1.2 2 4.6 2.9 1.8
Finland Europe & Central Asia FIN 0 0 0 0 0 0 0.1 0.5 0.2 0.1 0.1 0.8 0.2 0.7
France Europe & Central Asia FRA 0.1 0 0 0 0.1 0 0.1 0.7 0.5 0.1 0.6 1.1 0.3 0.7
Gabon Sub-Saharan Africa GAB 3.5 1.2 1.1 0.3 0.7 10.2 6.7 8.9 6.7 4 2.9 4.7 2.6 1.4
Gambia Sub-Saharan Africa GMB 5.3 0.5 1 0.3 1.1 14.5 9.1 9.4 9.3 5.4 5 4.9 3.4 2
Georgia Europe & Central Asia GEO 0.1 0 0.1 0 0.2 0 1 3.7 1.2 1 1.1 3.5 0.7 0.7
Germany Europe & Central Asia DEU 0 0 0 0 0 0 0.1 1.1 0.3 0.1 0.3 1.2 0.2 0.5
Ghana Sub-Saharan Africa GHA 6 0.6 1 0.7 1.4 15.7 10.3 10.6 9.7 5.7 5.6 5 3.7 1.8
Greece Europe & Central Asia GRC 0 0 0 0 0 0 0.1 1.4 0.3 0 0.1 2 0.2 0.4
Grenada Latin America & Caribbean GRD 0 0 0 0 0 0 0.1 1.8 1.8 0.8 1.8 2.3 0.3 3
Guatemala Latin America & Caribbean GTM 2.3 0.4 0.2 0 0.4 0 5.4 3.9 4.4 2.7 2.8 3.7 2.8 1.8
Guinea Sub-Saharan Africa GIN 8 1.6 1.2 0.8 2.3 27.4 13.3 10 12.4 5.7 7 3.3 4 2
Guinea-Bissau Sub-Saharan Africa GNB 11.7 4.5 1 0.5 3.3 22.1 17.6 13.7 15.4 8.4 8.9 4.8 5.1 3.7
Guyana Latin America & Caribbean GUY 1.9 0.4 0 0 0.3 3.1 2.1 7.2 4.4 2.3 5.8 3.3 2.4 4.6
Haiti Latin America & Caribbean HTI 8.7 0.7 1.4 0 2.1 0.4 14.5 10.3 8.3 4.4 8.7 5 5.5 2.5
Honduras Latin America & Caribbean HND 1.4 0.3 0.2 0 0.3 0 2.8 5.3 2.1 1.5 2.2 3.7 0.6 1.6
Hungary Europe & Central Asia HUN 0 0 0 0 0.1 0 0.3 2.3 0.4 0.2 0.3 1.8 0.2 0.6
Iceland Europe & Central Asia ISL 0 0 0 0 0 0 0 0.7 0 0 0.3 0.3 0.1 0.8
India South Asia IND 5.5 0.2 0.2 1.4 1.3 0.3 6.9 14.1 5.9 4.3 4.3 3.7 2 1.7
Indonesia East Asia & Pacific IDN 1.6 0.3 0.2 1.4 0.5 0.5 4.9 5.7 3.2 1.9 2.6 3.3 2.2 1.4
Iran Middle East & North Africa IRN 0.6 0 0.2 0 0.1 0 2.2 3.8 1.9 1.1 1.2 3.4 1.2 0.9
Iraq Middle East & North Africa IRQ 2.2 0 0.2 0 0.4 0 5.1 7 4.9 2.9 1.6 4.3 2.5 2.5
Ireland Europe & Central Asia IRL 0 0 0 0 0 0 0.1 0.9 0.3 0 0.2 1.6 0.2 0.5
Israel Middle East & North Africa ISR 0 0 0 0 0.1 0 0.1 1 0.2 0.1 0.3 1.4 0.2 0.7
Italy Europe & Central Asia ITA 0 0 0 0 0 0 0 1 0.3 0.1 0.5 0.9 0.1 0.6
Jamaica Latin America & Caribbean JAM 0.4 0.2 0.2 0 0.2 0 1.3 4.2 1.5 1.1 1.4 3.7 1.2 1.2
Japan East Asia & Pacific JPN 0.1 0 0 0 0 0 0.2 0.2 0.1 0.1 0.2 1.1 0.4 0.5
Jordan Middle East & North Africa JOR 0.7 0 0.2 0 0.1 0 1.9 5.2 1.8 1.1 0.9 4.3 1.4 1
Kazakhstan Europe & Central Asia KAZ 0.7 0 0.2 0 0.1 0 2.1 3 2.1 1 1 3.4 1.4 1.2
Kenya Sub-Saharan Africa KEN 7 3.1 1.1 0.2 1.6 3.1 12.3 8.9 9.8 4.5 6.8 4.4 4.7 2.5
Kiribati East Asia & Pacific KIR 6.1 0 0 0 1.2 0 10.8 7.8 7.5 3.3 6.1 5.2 4.6 4.7
Kuwait Middle East & North Africa KWT 0 0 0 0 0.1 0 0.7 3 0.3 0.1 0.2 3.7 0.6 0.7
Kyrgyzstan Europe & Central Asia KGZ 1.2 0 0.2 0 0.2 0 3.3 4.2 3.5 1.8 1.4 4.4 2.2 1.4
Laos East Asia & Pacific LAO 8.2 0.2 1.3 0 1.7 0.5 13.9 8.6 10.3 5.3 8.8 4.2 5.7 2.5
Latvia Europe & Central Asia LVA 0 0 0 0 0 0 0.2 0.8 2.7 0.6 0.4 2.5 0.5 0.6
Lebanon Middle East & North Africa LBN 0.2 0.1 0.1 0 0 0 0.6 2.7 0.9 0.4 0.7 2 0.5 0.6
Lesotho Sub-Saharan Africa LSO 7.3 19 1 0.4 1.6 0 12.1 14.7 14.5 7.5 6.9 4.4 4 2.5
Liberia Sub-Saharan Africa LBR 5.7 0.5 1.1 0 1.2 15.3 10 7.6 9.1 5.1 5.4 3.8 3.7 1.8
Libya Middle East & North Africa LBY 0.2 0 0.2 0 0.1 0 1.1 3.3 1.3 0.7 1 4 1.2 1.4
Lithuania Europe & Central Asia LTU 0 0 0 0 0.1 0 0.2 0.8 0.5 0.5 0.2 1.6 0.6 0.4
Luxembourg Europe & Central Asia LUX 0 0 0 0 0.1 0 0 0.4 0.1 0.1 0.3 0.3 0.3 0.4
Madagascar Sub-Saharan Africa MDG 5.2 0.6 1.1 0 1.2 4.1 10.1 6.9 7.1 3.9 5.3 3.3 4 2
Malawi Sub-Saharan Africa MWI 5 8.4 1 0.5 1.1 9.8 9 7.9 7.1 4.4 4.8 3.2 3.5 2
Malaysia East Asia & Pacific MYS 0.2 0 0.2 0 0.2 0 0.6 2 0.7 0.2 0.6 2.2 0.6 0.8
Maldives South Asia MDV 0.1 0 0.1 0 0.1 0 0.7 2.4 0.9 0.4 0.6 3 0.4 1
Mali Sub-Saharan Africa MLI 13.5 0.7 1.1 3 3.8 16.8 19.1 15.7 11.7 7.3 11.9 4.3 6.1 3.3
Malta Middle East & North Africa MLT 0 0 0 0 0.5 0 0 1.6 0.3 0.1 0.2 2.7 0.1 0.6
Marshall Islands East Asia & Pacific MHL 3 0 0 0.2 0.8 0 7.2 7.9 3.6 2.2 2.4 4.5 3 3.5
Mauritania Sub-Saharan Africa MRT 8.9 0.3 1.1 0.8 2.3 8.7 14.2 15.2 9.6 7.2 7.8 5.1 4.8 2.6
Mauritius Sub-Saharan Africa MUS 0.2 0 0 0 0.2 0 1.4 3.9 0.8 1 0.7 4.1 1.1 1
Mexico Latin America & Caribbean MEX 0.4 0 0 0 0.1 0 1.7 2.7 0.9 0.9 0.9 3.6 1.1 2.3
Micronesia East Asia & Pacific FSM 2.8 0 0 0.1 0.6 0 6.6 6.6 4.3 2.2 3 4.3 3 2.9
Monaco Europe & Central Asia MCO 0 0 0 0 0 0 0 0.9 0.3 0.1 0.2 0.8 0 0
Mongolia East Asia & Pacific MNG 2.4 0 0.2 0 0.4 0 5.2 5 3.7 1.6 2.3 5 3 2.8
Montenegro Europe & Central Asia MNE 0 0 0 0 0 0 0.3 1.6 2.2 0.1 0.1 0.4 0 0.6
Morocco Middle East & North Africa MAR 1.6 0 0.2 0 0.2 0 3.7 6.8 4.1 2.7 2.2 4.2 2 1.8
Mozambique Sub-Saharan Africa MOZ 7.3 5.7 1.1 0 1.8 15.4 12.2 10.6 9.7 5.9 6 3.6 4.1 2.9
Myanmar East Asia & Pacific MMR 3.7 0 0.2 1.5 0.8 1 7.6 10.4 6.2 3.2 5.5 3.3 4 2.6
Namibia Sub-Saharan Africa NAM 3.6 3.3 1.2 1.9 0.7 0 7.2 9.5 5.9 3.5 3.8 4.2 3.1 1.6
Nepal South Asia NPL 2.8 0.1 1.1 0 0.5 0 5.9 7.7 5.8 4.2 3.5 3.5 2.9 1.9
Netherlands Europe & Central Asia NLD 0 0 0 0 0.1 0 0.1 0.8 0.5 0.2 0.4 1.3 0.2 0.5
New Zealand East Asia & Pacific NZL 0.1 0 0 0 0 0 0.3 1.5 0.5 0.2 0.2 1.4 1.1 0.9
Nicaragua Latin America & Caribbean NIC 1.5 0.3 0.2 0 0.4 0 3.6 4.9 2.2 1 2.6 4.4 0.8 1.5
Niger Sub-Saharan Africa NER 11.8 0.4 1.1 0.6 3.4 18.9 17.7 10.1 8.3 4.5 11.2 2.5 6.1 3.1
Nigeria Sub-Saharan Africa NGA 11 3.5 1.4 0.7 3.6 23.8 17.2 14.1 12 5.9 8.9 3.7 5.2 2.7
Norway Europe & Central Asia NOR 0 0 0 0 0 0 0.1 0.5 0.3 0 0.4 1 0.1 0.4
Oman Middle East & North Africa OMN 0.1 0 0.2 0 0.1 0 0.7 3.1 1.2 0.3 0.4 3.2 0.7 1
Pakistan South Asia PAK 9 0 1.1 1.1 2.2 0.1 14.6 16.3 10.8 8.4 5.9 3.9 5.8 5.2
Palau East Asia & Pacific PLW 0.3 0 0 0.6 0.6 0 1.9 3.3 1.2 0.6 0.9 4.1 3.6 1.5
Panama Latin America & Caribbean PAN 1.7 0 0.2 0 0.2 0 2.5 2.8 0.9 1.3 1.5 4.2 1.1 1.3
Papua New Guinea East Asia & Pacific PNG 5.4 0.5 1.1 0 1.3 6.8 10.3 8.1 7.8 4.1 4.7 3.5 4.1 3.2
Paraguay Latin America & Caribbean PRY 1.2 0.1 1.1 0 0.3 0 2.6 5.2 1.7 1.5 1 4.5 1 1.5
Peru Latin America & Caribbean PER 0.7 0.1 0.2 0 0.3 0 1.8 3.3 1.3 0.7 1.6 3.7 1.2 1.7
Philippines East Asia & Pacific PHL 2.2 0 1.1 0.1 0.3 0 5 5.1 3.4 2.2 2.5 3.8 2.7 1.2
Poland Europe & Central Asia POL 0 0 0 0 0 0 0.2 1.8 0.3 0.2 0.1 1.9 0.2 0.4
Portugal Europe & Central Asia PRT 0 0 0 0 0 0 0.1 0.8 0.3 0.2 0.4 1.1 0.3 0.6
Qatar Middle East & North Africa QAT 0 0 0.1 0 0 0 0.3 2.4 0.7 0.2 0.5 2.2 0.7 0.8
South Korea East Asia & Pacific KOR 0 0 0 0 0.1 0 0.1 1.2 0.2 0.1 0.2 0.8 0.4 0.5
Moldova Europe & Central Asia MDA 0.2 0 0 0 0.3 0 2.9 1.9 0.6 0.6 0.3 5.6 2.1 1.2
Romania Europe & Central Asia ROU 0.1 0 0 0 0.1 0 3.3 3 0.6 0.1 0.5 2.9 0.8 0.6
Russia Europe & Central Asia RUS 0.1 0.1 0.1 0 0.2 0 0.8 2.2 0.7 0.4 0.7 3.1 0.9 0.9
Rwanda Sub-Saharan Africa RWA 4.8 0.8 1 0.3 0.9 2.2 9.1 6.1 6.8 3.8 4.8 4.1 4.1 2.3
St. Kitts and Nevis Latin America & Caribbean KNA 0 0.2 0 0 0 0 0.2 1.8 2.7 0.9 0.9 1.3 1 1.2
St. Lucia Latin America & Caribbean LCA 0 0 0 0 0 0 2.7 0 0 0 0 4.6 0.7 6.4
St. Vincent and the Grenadines Latin America & Caribbean VCT 0 0.1 0 0 0 0 0.4 7.1 2.4 0.4 1.1 2 1.1 4.6
Samoa East Asia & Pacific WSM 0.6 0 0.2 0.1 0.4 0 2.1 3.7 1.3 0.8 1.2 4.3 1.3 2.2
San Marino Europe & Central Asia SMR 0 0 0 0 0.1 0 0.2 0.2 0.2 0 0.2 1.4 0.5 0.6
Sao Tome and Principe Sub-Saharan Africa STP 4.4 0.3 0.2 0.7 0.8 4.3 8.2 6.6 6.5 3.5 4.6 5.2 3.6 2.3
Saudi Arabia Middle East & North Africa SAU 0.3 0 0.2 0 0.1 0 1.1 4.3 1.6 0.6 1 4 1.4 1.3
Senegal Sub-Saharan Africa SEN 3.5 0.5 1 1.1 0.7 9.2 6.9 8 6.9 4.6 3.1 4.2 2.7 1.8
Serbia Europe & Central Asia SRB 0 0 0 0 0.1 0 0.4 2.7 0.7 0.1 0.4 1.5 0.3 0.6
Seychelles Sub-Saharan Africa SYC 0.1 0 0 0 0.1 0 0.7 4.2 1.4 1.3 0.9 3.1 0.7 1.4
Sierra Leone Sub-Saharan Africa SLE 21.4 0.8 1 8.2 5.3 22.1 26.7 15.6 15.2 8.6 15.6 6.6 7.7 4.9
Singapore East Asia & Pacific SGP 0 0 0 0 0 0 0.2 0.7 0.2 0 0.2 0.7 0.2 0.5
Slovakia Europe & Central Asia SVK 0 0 0 0 0.1 0 1 2.7 0.8 0 0.3 2.7 0.4 0.9
Slovenia Europe & Central Asia SVN 0 0 0 0 0 0 0.1 0.7 0.2 0.2 0.1 1.5 0.4 0.6
Solomon Islands East Asia & Pacific SLB 2.6 0 1 0 0.7 2.4 6.3 4.8 4.3 2.4 2.5 3.7 2.4 1.2
Somalia Sub-Saharan Africa SOM 25.1 0.7 1.6 11.6 9.7 3.9 32 17.6 15.6 5.5 16.2 4.4 7.7 4.7
South Africa Sub-Saharan Africa ZAF 5.7 27.9 0.2 0.3 1.2 0 8.9 7.6 4.3 2.1 5.6 2.7 3.2 2.2
South Sudan Sub-Saharan Africa SSD 15.7 3.8 1.5 0.7 5.7 7.4 23.5 17.1 13.5 6.7 10.9 4 5.9 3.3
Spain Europe & Central Asia ESP 0 0 0 0 0.1 0 0.1 1.3 0.4 0.4 0.5 1.4 0.3 0.6
Sri Lanka South Asia LKA 0.4 0 0.1 0 0.1 0 0.9 2.8 1 0.7 0.8 3.4 0.6 1.4
Sudan Sub-Saharan Africa SDN 11 0.4 1.2 0.7 3.6 1.1 18.3 11.9 10.5 6.7 8.5 4.2 5.2 2.7
Suriname Latin America & Caribbean SUR 0.6 0.9 0 0 0.2 0.1 2.5 7.1 2.1 2.7 1 4.8 3 3
Swaziland Sub-Saharan Africa SWZ 10.2 38.8 1.3 0 3.7 0 16 11.7 11.4 5.9 6.1 4.3 4.1 3.3
Sweden Europe & Central Asia SWE 0 0 0 0 0.1 0 0.1 0.5 0.3 0.1 0.2 1.1 0.1 0.7
Switzerland Europe & Central Asia CHE 0 0 0 0 0 0 0.1 1.4 0.5 0.2 0.1 1.5 0.3 0.7
Syria Middle East & North Africa SYR 1.3 0 0.2 0 0.1 0 2.1 4.2 1.9 0.7 1 3.6 0.8 1.2
Tajikistan Europe & Central Asia TJK 6 0.1 0.2 0 1.8 0 11.8 8.8 8.1 4.2 4.3 4.3 4.1 4
Thailand East Asia & Pacific THA 0.6 0.2 0.1 0.1 0.2 0.1 1.5 3.8 1.3 1 1 4.1 0.9 1.7
Macedonia Europe & Central Asia MKD 0.1 0 0 0 0.6 0 0.9 4.9 0.7 0.2 0.4 3.3 0.4 0.9
Timor-Leste East Asia & Pacific TLS 6.9 0 1 0 2 10.8 12.3 7.9 9.3 4.7 6.2 2.9 4 2.5
Togo Sub-Saharan Africa TGO 9 5.1 1.1 0.6 3.1 18.7 14.7 11.6 11.7 6.4 6.8 4 3.9 2.1
Tonga East Asia & Pacific TON 0.3 0 0 0 0.3 0 1.3 3.4 1.1 0.8 0.7 3.8 1.3 1.5
Trinidad and Tobago Latin America & Caribbean TTO 0 0.7 0 0 0.2 0 1.8 5.4 3.1 0.8 3 6.1 1.5 2.9
Tunisia Middle East & North Africa TUN 0.7 0 0.1 0 0.1 0 2.2 4.5 2.2 1.1 1.6 4.4 1.3 1.8
Turkey Europe & Central Asia TUR 0.4 0 0.2 0 0.7 0 3.3 6.7 2.6 1.1 3.1 5.3 1.5 2.2
Turkmenistan Europe & Central Asia TKM 7.2 0 0.2 0 2.2 0 13.1 11.3 7.8 3.5 4.3 6.4 4.7 5.8
Tuvalu East Asia & Pacific TUV 1.6 0 0 0 0.9 0 6.5 6.3 2.6 1.6 2.5 5.7 3.7 2.1
Uganda Sub-Saharan Africa UGA 9.6 7.2 1.1 0.4 2.3 16.5 13.4 9.8 8.8 5 7.8 3.1 4.7 2.6
Ukraine Europe & Central Asia UKR 0.2 0.3 0.1 0 0.3 0 1.4 2.7 0.9 0.5 1 3.5 1.2 1
United Arab Emirates Middle East & North Africa ARE 0.1 0 0.1 0 0 0 0.3 2.8 0.9 0.2 0.6 2.6 0.8 0.7
United Kingdom Europe & Central Asia GBR 0 0 0 0 0.1 0 0.2 2.1 0.4 0.1 0.2 1.5 0.2 0.9
Tanzania Sub-Saharan Africa TZA 6 8.6 1.1 0.7 1.9 10.6 11.1 7.7 9 4.8 5.4 3.2 3.3 1.6
United States of America North America USA 0.1 0 0 0 0.1 0 0.2 2.2 0.3 0.2 0.8 1.9 0.9 1
Uruguay Latin America & Caribbean URY 0.3 0 0 0 0.3 0 1.4 2.9 0.7 1 0.8 3.7 1.3 1.4
Uzbekistan Europe & Central Asia UZB 6.2 0.1 0.2 0 1.8 0 11.8 7.3 5.2 2.2 5.5 5.4 4.2 3.4
Vanuatu East Asia & Pacific VUT 1.4 0 0.5 0.2 0.3 1.7 2.4 4.4 1.9 1.1 0.2 3.6 0.9 1.7
Venezuela Latin America & Caribbean VEN 1.5 0.1 0.1 0 0.2 0 1.8 4.2 1.5 1.3 1.4 3.3 1.5 0.8
Viet Nam East Asia & Pacific VNM 2.8 0.2 0.1 0.5 0.5 0 4.2 6 2.1 1.2 2.2 5.4 1 2.1
Yemen Middle East & North Africa YEM 9.3 0.1 1.2 2.7 1.6 0.9 13.1 10.8 8.8 5.4 5.6 3.2 5 4.7
Zambia Sub-Saharan Africa ZMB 12.8 19.9 1.1 0.5 2.7 19.3 15.5 9.7 10.8 5.9 9.1 3.2 4.9 3
Zimbabwe Sub-Saharan Africa ZWE 7 29.4 0.3 1.1 2.3 1.7 11.8 11.5 10.6 5.5 5.6 3.4 3.1 2
d3.helper = {};
d3.helper.tooltip = function(accessor){
return function(selection){
var tooltipDiv;
var bodyNode = d3.select('body').node();
selection.on("mouseover", function(d, i){
// Clean up lost tooltips
d3.select('body').selectAll('div.tooltip').remove();
// Append tooltip
tooltipDiv = d3.select('body').append('div').attr('class', 'tooltip');
var absoluteMousePos = d3.mouse(bodyNode);
tooltipDiv.style('left', (absoluteMousePos[0] + 10)+'px')
.style('top', (absoluteMousePos[1] - 15)+'px')
.style('position', 'absolute')
.style('z-index', 1001);
// Add text using the accessor function
var tooltipText = accessor(d, i) || '';
// Crop text arbitrarily
//tooltipDiv.style('width', function(d, i){return (tooltipText.length > 80) ? '300px' : null;})
// .html(tooltipText);
})
.on('mousemove', function(d, i) {
// Move tooltip
var absoluteMousePos = d3.mouse(bodyNode);
tooltipDiv.style('left', (absoluteMousePos[0] + 10)+'px')
.style('top', (absoluteMousePos[1] - 15)+'px');
var tooltipText = accessor(d, i) || '';
tooltipDiv.html(tooltipText);
})
.on("mouseout", function(d, i){
// Remove tooltip
tooltipDiv.remove();
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment