1

For a school project I'm working on a force directed layout with markers. Now I don't know how to change the direction of the markers ... When i implemented them most of them were immediatly in the right direction but some of them need to be reversed. Does anyone know if there is an easy way to do this ?

 //defining the markers
      svg.append("defs").selectAll("marker")
     .data(["normal", "reverse"])
     .enter().append("marker")
     .attr("id", function(d) { return d; })
     .attr("viewBox", "0 -5 10 10")
     .attr("refX", 19)
     .attr("markerWidth", 6)
     .attr("markerHeight", 6)
     .attr("orient", "auto")
     .append("path")
     .attr("d", "M0,-5L10,0L0,5");

//Drawing the markers
     var edgeSelection = svg.selectAll('.edge')
    .data(edges)
    .enter()
    .append('line')
    .classed('edge', true)
    .style("marker-start",  "url()")
    .style("marker-end",  "url(#normal)")
    .call(positionEdge, nodes);

I have been playing around with "marker-start" ,"marker-end", "orient" and "refX" but I can't get it to work ...

Thanks

0 Answers0