Search code examples
jgraphxjgraphmxgraph

Isn't there an "auto disposition" method?


I have a graph with nodes and edges and I want to display them. Isn't there any function which, given this graph, displays it without me to give exact coordinates?


Solution

  • yes, you can use the auto layout http://jgraph.github.io/mxgraph/docs/js-api/files/layout/mxCompactTreeLayout-js.html this url construct a compact tree layout.

    var layoutMgr = new mxLayoutManager(graph);
        layoutMgr.getLayout = function(cell) {
        return layout;
    };