chart = {
const svg = d3.select(DOM.svg(width, height));
svg.selectAll("path")
.data(states.features)
.enter()
.append("path")
.attr("d", path)
.style("fill", function(d) {
var value = d.properties.value;
if (value) {
return color(value);
} else {
return "#ccc";
}
});
svg.selectAll("circle")
.data(cities)
.enter()
.append("circle")
.attr("cx", function(d) {
return projection([d.lon, d.lat])[0];
})
.attr("cy", function(d) {
return projection([d.lon, d.lat])[1];
})
.attr("r", function(d){
return Math.sqrt(parseInt(d.population) * 0.00004);
})
.style("fill", "yellow")
.style("stroke", "gray")
.style("stroke-width", 0.25)
.style("opacity", 0.75)
.append("title")
.text(function(d) {
return d.place + ": Pop. " + formatAsThousands(d.population);
})
return svg.node();
}