vote_map_population_bubble = {
const height = (width * 5) / 8;
const svg = d3
.select(DOM.svg(width, height))
.attr("viewBox", "0 0 960 600")
.style("width", "100%")
.style("height", "auto");
var defs = svg.append("defs");
var filter = defs
.append("filter")
.attr("id", "drop-shadow")
.attr("height", "130%");
filter
.append("feGaussianBlur")
.attr("in", "SourceAlpha")
.attr("stdDeviation", 6)
.attr("result", "blur");
filter
.append("feOffset")
.attr("in", "blur")
.attr("dx", 2)
.attr("dy", 2)
.attr("result", "offsetBlur");
var feMerge = filter.append("feMerge");
feMerge.append("feMergeNode").attr("in", "offsetBlur");
feMerge.append("feMergeNode").attr("in", "SourceGraphic");
svg
.append('rect')
.attr('width', width / 1.5)
.attr('x', 100)
.attr('y', 10)
.attr('height', height * 0.95)
// .attr('stroke', '#546767')//#FFF8E7
.attr('stroke', '#FFF8E7') //
.attr('stroke-width', 4)
.style("filter", "url(#drop-shadow)")
.attr('fill', 'none');
svg
.append('rect')
.attr('width', width / 1.5)
.attr('x', 100)
.attr('y', 10)
.attr('height', height * 0.95)
.attr('fill', '#FFF8E7');
const rovinj = [13.732390615654477, 45.02254149187571];
const legend = svg
.append("g")
.attr("fill", "#777")
.attr("transform", "translate(500,300)")
.attr("text-anchor", "middle")
.style("font", "7px sans-serif")
.selectAll("g")
.data(radiusScale.ticks(3).slice(1))
.join("g");
legend
.append("circle")
.attr("fill", "none")
.attr("stroke", "#ccc")
.attr("cy", d => -radiusScale(d))
.attr("r", radiusScale);
legend
.append("text")
.attr("y", d => -2 * radiusScale(d))
.attr("dy", "1.3em")
.text(radiusScale.tickFormat(4, "s"));
svg
.append('text')
.attr('x', 100 + 20)
.attr('y', 40)
.attr('fill', '#546767')
.attr('text-anchor', 'start')
.attr('font-size', 24)
.style('opacity', 1)
.text(`Predsjednički izbori 2020. (drugi krug)`);
svg
.append('text')
.attr('x', 100 + 20)
.attr('y', 65)
.attr('fill', '#546767')
.attr('text-anchor', 'start')
.attr('font-size', 20)
.style('opacity', 1)
.text(`Razlika u glasovima KGK-Zoky`);
let credit = svg
.append('text')
.attr('x', projection(rovinj)[0] - 20) // rovinj width / 2 + 100
.attr('y', projection(rovinj)[1]) //height / 2
.attr('fill', '#546767')
.attr('text-anchor', 'end')
.attr('font-size', 10)
.style('opacity', 1)
.text(`@velimirgasp`);
const paths = svg
.selectAll('path')
.data(topojson.feature(croatia, croatia.objects['hrvatska']).features)
.enter()
.append('path')
.attr('fill', 'white')
.attr('stroke', 'lightgrey')
.attr("stroke-linejoin", "round")
.attr('d', path);
svg
.append("g")
.selectAll("circle")
.data(municipalities)
.enter()
.append("circle")
.attr('opacity', 0.5)
.attr("fill", county => {
if (county.properties.votes.kgk < county.properties.votes.zoky) {
return '#c93135';
} else {
return '#1375b7';
}
})
.attr("cx", d => (d.properties.centroid ? d.properties.centroid[0] : 0))
.attr("cy", d => (d.properties.centroid ? d.properties.centroid[1] : 0))
.attr("r", d => d.properties.radius)
.style("stroke", "white")
.style('stroke-width', 0.4);
return svg.node();
}