layout

layout.alignBy

alignBy(axis: "x" | "y" | "z", nodeIds?: string[]): Promise<void>

Flatten all selected nodes onto a single value along the given axis.

Useful for projecting a 3-D graph onto a 2-D plane.

Recorded in history as "SetPositions" or "DragPositions". Emits "layout:start" and "layout:end".

axis"x" | "y" | "z"The axis along which to align: "x", "y", or "z".
nodeIdsstring[]Subset of nodes to align; defaults to all nodes.

Returns: Promise<void>

Example

await api.layout.alignBy("z"); // flatten graph onto Z=0 plane