tooltip = {
chart1;
const tooltip = d3
.select("body")
.append("div")
.attr("class", "svg-tooltip")
.style("position", "absolute")
.style("visibility", "hidden")
.style('pointer-events','none');
d3.selectAll("rect")
.on("mouseover", function(event, d) {
d3.select(this)
.raise()
.attr('stroke-width', '2')
.attr("stroke", "black");
tooltip
.style("visibility", "visible")
.text(`Date: ${d.date}\nDisaster: ${d.disaster}\n${d.eventName}\nCountry: ${d.country}`);
})
.on("mousemove", function(event, d) {
tooltip
.style("top", event.pageY - 10 + "px")
.style("left", event.pageX < width/2? event.pageX + 10 + "px" : event.pageX - 150 + "px");
})
.on("mouseout", function() {
d3.select(this).lower().attr('stroke-width', '0');
tooltip.style("visibility", "hidden");
})
.on("click", function() {
d3.select(this)
.attr("xlink:href", "http://en.wikipedia.org/wiki/")
});
}