d3 / d3-sankey

Visualize flow between nodes in a directed acyclic network.
https://observablehq.com/collection/@d3/d3-sankey
BSD 3-Clause "New" or "Revised" License
826 stars 255 forks source link

Is it possible to have fixed nodes at same height #83

Open yshaik77 opened 4 years ago

yshaik77 commented 4 years ago

In my example there is only one link between two nodes but yet the link has curvature instead of straight line . How to change this function to make link come as a straight line . value is 1 and two nodes sankey.link = function () { var curvature = 0.5;

    function link(d) {
        var x0 = d.source.x + d.source.dx,
            x1 = d.target.x,
            xi = d3.interpolateNumber(x0, x1),
            x2 = xi(curvature),
            x3 = xi(1 - curvature),
            y0 = d.source.y + d.sy + d.dy / 2,
            y1 = d.target.y + d.ty + d.dy / 2;
        return "M" + x0 + "," + y0
             + "C" + x2 + "," + y0
             + " " + x3 + "," + y1
             + " " + x1 + "," + y1;
    }