rect_time_tree_chart_recomb = {
const root = d3.hierarchy(localTree.root)
.sum(d => d.children ? 0 : 1)
.sort((a, b) => (a.value - b.value) || d3.ascending(a.data._length, b.data._length));
rectCluster(root);
setRadius(root, root.data._length = 0, maxLength(root));
setColor(root);
var recombLinks = makeAllRecombinationEvents(root);
const svg = d3.create("svg")
.attr("viewBox", [0, -10 , height + 10, width + 10])
.attr("font-family", "sans-serif")
.attr("font-size", 10);
svg.append("style").text(`
.link--active {
stroke: #69b3a2 !important;
stroke-width: 8px;
stroke-opacity: 1.0;
}
.recombLink--active {
stroke: #1F51FF !important;
stroke-width: 10px;
stroke-opacity: 1.0;
}
.tips--active {
fill: #226b94 !important;
r: 16;
}
.label--active {
font-weight: bold;
}
`);
const link = svg.append("g")
.attr("fill", "none")
.attr("stroke", "#696969")
.attr("stroke-width", "3px")
.selectAll("path")
.data(root.links())
.join("path")
.each(function(d) { d.target.linkNode = this; })
.attr("d", linkVariableHorizontal);
const recombLink = svg.append("g")
.attr("fill", "none")
.attr("stroke", "#696969")
.attr("stroke-width", "3px")
.selectAll("path")
.data(recombLinks)
.join("path")
.each(function(d) { d.target.recombLinkNode = this; })
.style("stroke-dasharray", ("20, 5"))
.attr("d", linkVariableHorizontal);
const tips = svg.append("g")
.selectAll("circle")
.data(root.leaves())
.join("circle")
.attr("dy", ".31em")
.attr("fill", "#226b94")
.attr("fill-opacity", 0.8)
.attr("transform", d => `translate(${d.radius},${d.x})`)
.attr("r", 11);
tips
.on('mouseover', mouseovered(true))
.on('mouseout', mouseovered(false))
function mouseovered(active) {
return function(event, d) {
if (active) {
link.style('stroke', "#B8B8B8").style("opacity", 1.0)
recombLink.style('stroke', "#B8B8B8").style("opacity", 1.0)
tips.style('fill', "#AAC5D5")
}
else {
link.style('stroke', "#696969").style("opacity", 1.0)
recombLink.style('stroke', "#696969").style("opacity", 1.0)
tips.style('fill', "#226b94")
}
d3.select(this).classed("tips--active", active);
d3.select(this).classed("label--active", active);
do {
d3.select(d.linkNode).classed("link--active", active).raise();
d3.select(d.recombLinkNode).classed("recombLink--active", active).raise();
}
while (d = d.parent);
};
}
return Object.assign(svg.node());
}