addLinks = (chart) => {
const type = d3.select(chart).node().tagName;
let wrapper =
type === "FIGURE" ? d3.select(chart).select("svg") : d3.select(chart);
const svgs = d3.select(chart).selectAll("svg");
if (svgs.size() > 1) wrapper = d3.select([...svgs].pop());
wrapper.selectAll("title").each(function () {
const title = d3.select(this);
const parent = d3.select(this.parentNode);
const grandParent = d3.select(this.parentNode.parentNode);
const a = grandParent
.append("a")
.attr("href", title.text())
.attr("target", "_blank");
var removed = parent.remove();
a.append(function () {
return removed.node();
});
});
return chart;
}