Network multi-route orthogonal graph in d3.js

前端 未结 3 1247
粉色の甜心
粉色の甜心 2021-02-06 07:30

We want to use d3 to draw a network route graph that has fixed start and end node but different paths in between that might share some nodes, for example:

3条回答
  •  别跟我提以往
    2021-02-06 08:10

    See my demo here。

    http://jsfiddle.net/doraeimo/JEcdS/

    The main idea is to make a connectivity based on a tree.

        //1)temporarily convert a connectivity to a tree        
        var tree = conv2tree(data);
    
        //2)calculate for nodes' coords with cluster.nodes(tree);
        var nodes = buildNodes(tree);
    
        //3)append all the edges(links) of the connectivity
        var links = buildLinks(data);
    

提交回复
热议问题