I want to center childrens in TreeLayout.The childrens default left in TreeLayout

default style:

change style which i want:

i don’t want to change layout,because i need to use some api which is part of Treelayout.

Sorry, but I hope you understand tbat your graph structure is not a tree, so using TreeLayout might not do what you want.

i used LayeredDigraphLayout before,but i must get node and get level of node when operating.
for example export model data:

load: function () {
    for (var it = myDiagram.nodes; it.next();) {
        var n = it.value;  // n is now a Node or a Group
        n.data.taskInfo.level = n.findTreeLevel();
    }
},

or adding valiate function,i must get node level to valiate. @walter

i find the api of node is applied to all layouts. Is it right?

I think Node.findTreeLevel may work for you if that is what you want. However it would be better to override a method such as LayeredDigraphLayout.commitLayers, at which time you can iterate over all of the this.network.vertexes to look at each LayeredDigraphVertex.layer. Note that the layer numbers are zero-based starting with the deepest layer.

I’m afraid that I do not understand your question about “the api of node is applied to all layouts”. Most of the predefined Layouts classes work on a LayoutNetwork of LayoutVertexes and Layout.Edges. They do not work on directly on a collection of Nodes and Links, other than to create the network (in the call to Layout.makeNetwork) and then to commit the node positions and link routes when done (in the call to Layout.commitLayout).