assignTreeVertexValues method

void assignTreeVertexValues(
  1. TreeVertex v
)

Assign final property values for a TreeVertex.

This method is commonly overridden in order to provide tree layout properties for particular nodes. This method is called after values have been inherited from other TreeVertexes, so you can examine and modify the values of related tree nodes. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

However, when TreeVertex#alignment is TreeLayout.AlignmentBusBranching, changing the TreeVertex#sorting or TreeVertex#comparer properties in this method will have no effect.

This method should not walk the tree, since it is called for each TreeVertex in a depth-first manner starting at a root.

Here is an example where the children are squeezed together if there are many of them, but only on nodes that have no grandchildren. This makes use of two TreeVertex properties that are automatically computed for you, TreeVertex#childrenCount and TreeVertex#descendantCount.

  function SqueezingTreeLayout() {
    go.TreeLayout.call(this);
  }
  go.Diagram.inherit(SqueezingTreeLayout, go.TreeLayout);

  public assignTreeVertexValues(v) {
    if (v.childrenCount > 6 && v.childrenCount === v.descendantCount) {
      v.alignment = go.TreeLayout.AlignmentBottomRightBus;
      v.layerSpacing = 10;
      v.rowSpacing = 0;
    }
  }

If you need to assign TreeVertex values and also have them be "inherited" by the child vertexes, you should override #initializeTreeVertexValues instead. However at the time that method is called, the computed properties of TreeVertex will not be available. @expose @param {TreeVertex} v @since 1.1

Implementation

void assignTreeVertexValues(_i3.TreeVertex v) {
  _i4.callMethod(
    this,
    'assignTreeVertexValues',
    [v],
  );
}