Org Chart Assistants

I am new on GoJS, I studies the “Org Chart Assistants” sample. My question is how do I align all assistants on the right side of their parent, if the parent has more than one assistants.

Try replacing AlignmentBuswith AlignmentBottomRightBus.

It works for assistants but it also shift regular children to right too. How can I keep parent center regular children subtree.

Sorry, I only meant in assignTreeVertexValues.

Thanks you for quick respond. Yes I did change the AlignmentBus to AlignmentBottomRightBus in the assignedTreeVertexValue function, it still didn;t work, all regular children were shifted to the right

Also I have tried to modify a block of code inside the makeNetwork function (see below)

// if the number of assistants is odd, add a dummy assistant, to make the count even
if (acount % 2 == 1)
{
var dummy = net.createVertex();
net.addVertex(dummy);
net.linkVertexes(parent, dummy, asstedges.first().link);
}

Is replace with the following code:

// try to pair the assistant with dummy and assume the dummy is place on the
// left and assistant is placed on the right because the layout is AlignmentBus
var eit = asstedges.iterator;
while (eit.next())
{
var val = eit.value;
var dummy = net.createVertex();
net.add(Vertex(dummy);
net.linkVertexes(parent, dummy, val.link);
}

but the assistants are still paced on both sides of the parent

Ah yes, what I suggested does not work correctly. Sorry about that, but at the time I was unable to actually try any code.

I’ve tried this, and it seems to work without modifying assignTreeVertexValues. Just comment out some code in SideTreeLayout.makeNetwork and add some lines:

        . . .
        //// if the number of assistants is odd, add a dummy assistant, to make the count even
        //if (acount % 2 == 1) {
        //  var dummy = net.createVertex();
        //  net.addVertex(dummy);
        //  net.linkVertexes(parent, dummy, asstedges.first().link);
        //}
        // now PARENT should get all of the assistant children
        eit = asstedges.iterator;
        while (eit.next()) {
          var dummy = net.createVertex();
          net.addVertex(dummy);
          net.linkVertexes(parent, dummy, null);
          parent.addDestinationEdge(eit.value);
        }
        // create substitute vertex to be new parent of all regular children
        . . .

Thanks you. It worked, but when the assistant has children, the children are not placed in alignmentBus that was not a desired result, I would like the assistant and his children have a layout as other managers. Please help me to resolve this issue, because this special layout will be used in the case when senior manager has staffs, assistant and managers, the staff (not manager) might have children and always stay on the left opposite to assistant and the staff’s children must place in alingmentBus (same as assistant layout)

If assistant nodes have subtrees, they will be laid out normally.

Could you sketch what it is that you want?

Thanks you. Yes if assistant has children, then it will have the same layout as other managers. I just resolved this issue by adding the line of code inside the “for loop” of makeNetwork function.

For ( var it = vertexcoll.iterator;it.netx(); )
{
Var parent = it.value;
// check if parent is assistant, then do nothing
If ( isAssistant(prent.node) === true) continue;
}

Again thank you very much for your helps to customize the assistants.