{
const svg = d3.select(DOM.svg(width, height))
var defs = svg.append('defs');
let goo
var filter = defs.append('filter').attr("id", (goo = DOM.uid("gooey")).id);
filter.append('feGaussianBlur')
.attr('in','SourceGraphic')
.attr('stdDeviation','3')
.attr('result','blur');
filter.append('feColorMatrix')
.attr('in','blur')
.attr('mode','matrix')
.attr('values',
'1 0 0 0 0 \
0 1 0 0 0 \
0 0 1 0 0 \
0 0 0 16 -3'
)
.attr('result','gooey');
filter.append('feComposite')
svg.append('path')
.datum(world)
.attr('d', geoPath)
.attr('stroke', '#111')
.attr('stroke-width',0.25)
.attr('fill', '#000');
svg.append('g').attr('id', 'circles')
.attr('filter', () => {return gooey ? goo : ''})
.selectAll('.dot')
.data(places.features)
.enter().append('path')
.attr('d',geoPath)
.attr('transform', d => {
var centroid = geoPath.centroid(d),
x = centroid[0],
y = centroid[1];
return "translate(" + x + "," + y + ")"
+ `scale(${(6 - d.properties.scalerank)*bubblesize/10})`
+ "translate(" + -x + "," + -y + ")";
})
.attr('fill', (d,i) => {
return scale(d.properties.scalerank)
})
return svg.node();
}