tooltip = {
var visFlag = false;
const tooltip = d3.select("body").append("div")
.attr("class", "svg-tooltip")
.style("position", "absolute")
.style("visibility", "hidden")
d3.selectAll(".circle")
.on("click", function(d){
if (!visFlag) {
let table = tooltip.style("visibility", "visible")
.style("top", (d3.event.pageY-10)+"px")
.style("left",(d3.event.pageX+10)+"px")
.text(d.name).append("table")
let place = d.name
let rows = table.selectAll("tr")
.data(bw_glams.filter(d => d.city === place))
.enter()
.append("tr").append("td").append("a").attr("href", d => d.link).attr("target", "_blank")
.text(d => d.institution);
rows
.on("click", function(){
return tooltip.style("visibility", "visible");
})
let button = tooltip.append("div").attr("class", "btn");
button.text("{x}")
.on("click", function(){
return tooltip.style("visibility", "hidden");
})
visFlag = true;
return tooltip;
} else {
visFlag = false;
return tooltip.style("visibility", "hidden");
}
})
}