d3.js - On click of parent node in tree layout, Like link and node, linkText should also exit -
on click of parent node in tree layout, link , linktext should exit. link exiting not linktext. here jsfiddle project. tried code - svg.selectall(".line-label").remove();
deleting linktext labels should not happen. expecting on click of node exits linktext link , node current branch of tree not whole tree itself.
you can adding link in update:
//add text link svg.selectall(".line-label").data(links).enter().append("text") .attr("font-family", "arial, helvetica, sans-serif") .attr("fill", "black") .attr("class", "line-label") .style("font", "normal 12px arial") .attr("transform", function (d) { return "translate(" + (d.target.y - 30) + "," + (d.target.x - 10) + ")"; }) .attr("text-anchor", "middle") .text(function (d) { return d.target.label; }); //remove link text in update svg.selectall(".line-label").data(links).exit().remove();
full running code here
hope clarifies concern! :)
Comments
Post a Comment