d3.js - D3js force layout with rectangle text groups overlapping -


Hi I am trying to use the force layout of d3js ... I am creating a live element with the rect and text inside them. And apply force but they overlap, I think it does not solve the reset size, what am I doing?

  var force = D3 Layout. Force () .node (nodes). Link ([]). Size ([w, h]); Force ("Tick", function (e) {vis.selectAll ("g") .attr ("transform", function (d) {return "translation (" + dx + "," + dy + ")";} );}); Nodes. Push ({w: 100, h: 50, value: 'grandfather'}); Nodes Peach ({w: 100, h: 50, val: 'zona'}); // Restart layout from the start (); ("G") .attr ("transform", function (d) {return "translate" (+ + dx + "," + + + ")";}). Call (force drug); Node .append ("rect") .attr ("width", function (d) {return dw;}) .attr ("height", function (d) {return dh;}) .style ("fill", " ("Stroke", "white") style ("stroke-width", "1.5px") node .append ("text") .text (function (d) {return d.val;}) style ("font size "," 12px ") .attr (" dy "," 1em ")  

There are properties that you can set in your d3.layout.declaration () which will allow you to handle overlap, such as:

  var force = D3.layout.force (). Nodes (nodes). Link ([]) .Guverti (0.05). Charges (-1500) .Link Conflict (100). Frame (0.5). Size ([W, H ]);  

Important note: I borrowed the data from somewhere else and therefore the above values ​​will need to be sprayed by you, hopefully it helps. / P>


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -