Note that there are some explanatory texts on larger screens.

plurals
  1. POD3.js identifying links between nodes to change link thickness
    primarykey
    data
    text
    <p>I have been setting up graphs to dynamically scale in reference to the width and height of the svg or bounding box, and with nodes and node borders this is relatively simple. By using d.depth and assigning the desired ratio to assign a relative radius to a node at a certain depth, this is giving me no problems and nodes at lower depths become smaller to avoid overlap. Then, for the node border I assign a ratio between the node radius and the thickness of the border.</p> <p>This has proven to be an ideal solution to a problem that arises when adding a zoom feature by scaling the container. This is the problem:</p> <p><img src="https://i.stack.imgur.com/hlgwx.jpg" alt="enter image description here"> </p> <p>The text, the nodes, and the node borders no longer bunch up, but the links remain the same weight.</p> <p>I would also like to scale the thickness of the edges between nodes but I do not know how to identify edges so that I can either assign a thickness in relation to the radius of the parent or child node </p> <pre><code>d3.json("aviation.json", function(root) { var nodes = balloon.nodes(root), links = balloon.links(nodes); var link= svg.selectAll("path") .data(links) .enter().append("path") .attr("d",diagonal) .attr("stroke", "black") .attr("shape-rendering", "auto") .attr("fill", "none") .data(nodes) .attr("stroke-width", function(d) {return (1/5000*diameter);}); var node = svg.selectAll("g.node") .data(nodes) .enter() .append("g") .attr("class", "node"); node.append("circle") .attr("r", function(d) { return d.r;}) .attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }) .attr("fill", "white") .attr("opacity", "0.05") .attr("stroke-width", function(d) {return d.r/600;}) //here I am referecing d.r //to find the stroke width. .attr("stroke-opacity", ".5") .on("Click", function(d) { return zoomClick}); var text = svg.selectAll("g.text") .data(nodes) .enter() .append("text") .attr("dx", function(d) { return d.x }) .attr("dy", function(d) { return d.y }) .attr("font-family", "Helvetica") .attr("font-size", function(d) {return d.children ? d.r/7 : d.r/4;}) .attr("stroke-width", function(d) {return d.r/400;}) .attr("stroke-opacity", "1") .attr("fill", "white") .attr("pointer-events", "all") .style("text-anchor", "middle") .text(function(d) { return d.name; }) </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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