Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>change line 35, line 56 and elbow function to</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;meta charset="utf-8"&gt; &lt;style&gt; text { font-family: "Helvetica Neue", Helvetica, sans-serif; } .name { font-weight: bold; } .about { fill: #777; font-size: smaller; } .link { fill: none; stroke: #000; shape-rendering: crispEdges; } &lt;/style&gt; &lt;body&gt; &lt;script src="http://d3js.org/d3.v2.min.js?2.9.4"&gt;&lt;/script&gt; &lt;script&gt; var margin = {top: 0, right: 0, bottom: 320, left: 0}, width = 960- margin.left - margin.right, height = 500 - margin.top - margin.bottom; var tree = d3.layout.tree() .separation(function(a, b) { return a.parent === b.parent ? 1 : .5; }) .children(function(d) { return d.parents; }) .size([width, height]); var svg = d3.select("body").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); d3.json("tree.json", function(json) { var nodes = tree.nodes(json); var link = svg.selectAll(".link") .data(tree.links(nodes)) .enter().append("path") .attr("class", "link") .attr("d", elbow); var node = svg.selectAll(".node") .data(nodes) .enter().append("g") .attr("class", "node") .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }) node.append("text") .attr("class", "name") .attr("x", 8) .attr("y", -6) .text(function(d) { return d.name; }); node.append("text") .attr("x", 8) .attr("y", 8) .attr("dy", ".71em") .attr("class", "about lifespan") .text(function(d) { return d.born + "–" + d.died; }); node.append("text") .attr("x", 8) .attr("y", 8) .attr("dy", "1.86em") .attr("class", "about location") .text(function(d) { return d.location; }); }); function elbow(d, i) { console.log(d) return "M" + d.source.x + "," + d.source.y + "V" + d.target.y + "H" + d.target.x + (d.target.children ? "" : ("v" + margin.bottom)) } &lt;/script&gt; &lt;/body&gt; </code></pre> <p>this my result<img src="https://i.stack.imgur.com/mjFWg.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload