chart3 = {
const tree_df = radialLayout(readTree(treestring))
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("font-family", "sans-serif")
.attr("font-size", 10);
var group = svg.append("g");
function zoomed() {
group.attr("transform", d3.event.transform);
}
svg.call(d3.zoom()
.extent([[0, 0], [width, height]])
.scaleExtent([1, 8])
.on("zoom", zoomed));
var stroke_width = 3
group.append("g")
.attr("class", "phylo_lines")
.selectAll("lines")
.data(tree_df.arcs)
.join("path")
.attr("d", d => describeArc(xScale(0), yScale(0), d.radius*1225, d.start, d.end))
.attr('fill-opacity', '0')
.attr("class", "path")
.attr("stroke", "#777")
.attr("stroke-width", stroke_width)
group.append("g")
.attr("class", "phylo_lines")
.selectAll("lines")
.data(tree_df.radii)
.join("line")
.attr("class", "lines")
.attr("x1", d => xScale(d.x0))
.attr("y1", d => yScale(d.y0))
.attr("x2", d => xScale(d.x1))
.attr("y2", d => yScale(d.y1))
.attr("stroke-width", stroke_width)
.attr("stroke", "#777");
const tooltip = d3.select("body").append("div")
.attr("class", "svg-tooltip")
.attr("class", "tiplabs")
.style("position", "absolute")
.style("visibility", "hidden")
.style("background-color", "black")
group.append("g")
.attr("class", "phylo_points")
.selectAll(".dot")
.data(tree_df.radii)
.join("circle")
.attr("class", "dot")
.attr("r", function(d) {
if (d.isTip) {
return(4);
} else {
return(3);
}
})
.attr("cx", d => xScale(d.x0))
.attr("cy", d => yScale(d.y0))
.attr("stroke", "black")
.attr("stroke-width", 2)
.attr("fill", function(d) {
if (d.isTip) {
return("black");
} else {
return("white");
};
})
.on("mouseover", function(){
return tooltip.style("visibility", "visible");
})
.on("mousemove", function(d){
return tooltip
.style("top", (d3.event.pageY-10)+"px")
.style("left",(d3.event.pageX+10)+"px")
.style("color", "white")
.text(tree_df => d.thisId)
})
.on("mouseout", function(){
return tooltip.style("visibility", "hidden");
});
return svg.node()
}