How to draw straight line links between nodes (line stright and 90 degrees beteen nodes)

824 views
Skip to first unread message

Vijaya Sankar

unread,
May 4, 2016, 11:24:01 PM5/4/16
to d3-js

Hi,

I am trying to change diagonal method to get straight links with 90 degrees curves.

Out of the box given diagonal method we are able to draw curved lines but i want straight lines with 90 degrees between nodes.


Thanks,
Vijay Shankar


Vijaya Sankar

unread,
May 4, 2016, 11:24:59 PM5/4/16
to d3-js

var diagonal = d3.svg.diagonal()
        .projection(function (d) {
            return [d.y + 15, d.x];
        });


Thanks,
Vijay Shankar


Vijaya Sankar

unread,
May 5, 2016, 5:21:14 AM5/5/16
to d3-js
Thanks,

achieved the same using

    function elbow(d, i) {
            return "M" + d.source.y + "," + (d.source.x)
      + "H" + (d.target.y - 50) + "V" + (d.target.x + 6)+ "H" + (d.target.y);
}

I think M,V, H help  ful for this kind.

https://www.w3.org/TR/SVG/paths.html

Thanks,
Vijay shankar





On Thursday, May 5, 2016 at 8:54:01 AM UTC+5:30, Vijaya Sankar wrote:
Reply all
Reply to author
Forward
0 new messages