Tuesday, March 14, 2017

Link Labels in D3 at Midpoint:

Adding a Label to the Links (StackOverflow):

http://stackoverflow.com/questions/23470330/adding-label-to-the-links-in-d3-force-directed-graph

Labels to avoid overlap:

http://stackoverflow.com/questions/17425268/d3js-automatic-labels-placement-to-avoid-overlaps-force-repulsion

Meh.. (place a node at the midpoint where the node label should be somehow)

???

 var linknodes = svgContainer.append("g")
                  .attr("class","nodes")
                  .selectAll("circles")
                  .data(graph.links)
                  .enter().append("circle").attr("r",20)
                  .attr("fill", function(d) { return color(d.group); })
                  .call(d3.drag()
                  .on("start", dragstarted)
                  .on("drag", dragged)
                  .on("end", dragended));

function ticked() {

    linknodes
        .attr("x", function(d) { return (d.source.x + d.target.x)/2; })
        .attr("y", function(d) { return (d.source.y + d.target.y)/2; });

}

simulation
      .nodes("brents midpoint nodes")
      .on("tick", ticked);

but this does not work....I need to figure out how to create nodes on the fly

http://stackoverflow.com/questions/9539294/adding-new-nodes-to-force-directed-layout

references : https://bl.ocks.org/mbostock/1095795

http://stackoverflow.com/questions/17529522/transparent-color-in-javascript-d3-js

No comments:

Post a Comment