# Class SwimLaneLayout

GoJS® Diagramming Components
version 3.0.5
by Northwoods Software®

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.

#### Hierarchy

- LayeredDigraphLayout
  - SwimLaneLayout

A custom LayeredDigraphLayout that knows about "lanes" and that positions each node in its respective lane.

This assumes that each Node.data.lane property is a string that names the lane the node should be in. You can set the laneProperty property to use a different data property name. It is commonplace to set this property to be the same as the go.GraphLinksModel.nodeGroupKeyProperty, so that the one property indicates that a particular node data is a member of a particular group and thus that that group represents a lane.

The lanes can be sorted by specifying the laneComparer function.

You can add extra space between the lanes by increasing laneSpacing from its default of zero. That number's unit is columns, go.LayeredDigraphLayout.columnSpacing, not in document coordinates.

If you want to experiment with this extension, try the SwimLaneLayout sample.

#####
Index

### Constructors

constructor

### Accessors

laneBreadths
laneComparer
laneNames
lanePositions
laneProperty
laneSpacing

### Methods

computeMinLaneWidth
findLane
getLane

#####
Inherited Index

### Accessors

LayeredDigraphLayout.aggressiveOption
LayeredDigraphLayout.alignOption
LayeredDigraphLayout.columnSpacing
LayeredDigraphLayout.cycleRemoveOption
LayeredDigraphLayout.direction
LayeredDigraphLayout.initializeOption
LayeredDigraphLayout.iterations
LayeredDigraphLayout.layerSpacing
LayeredDigraphLayout.layeringOption
LayeredDigraphLayout.maxColumn
LayeredDigraphLayout.maxIndex
LayeredDigraphLayout.maxIndexLayer
LayeredDigraphLayout.maxLayer
LayeredDigraphLayout.minIndexLayer
LayeredDigraphLayout.packOption
LayeredDigraphLayout.setsPortSpots
Layout.arrangementOrigin
Layout.boundsComputation
Layout.diagram
Layout.group
Layout.isInitial
Layout.isOngoing
Layout.isRealtime
Layout.isRouting
Layout.isValidLayout
Layout.isViewportSized
Layout.network

### Methods

LayeredDigraphLayout.assignLayers
LayeredDigraphLayout.commitLayers
LayeredDigraphLayout.commitLayout
LayeredDigraphLayout.commitLinks
LayeredDigraphLayout.commitNodes
LayeredDigraphLayout.createNetwork
Layout.cloneProtected
Layout.collectParts
Layout.copy
Layout.getLayoutBounds
Layout.initialOrigin
Layout.invalidateLayout
Layout.makeNetwork
Layout.updateParts

## Constructors

### constructor

- new SwimLaneLayout(init?: Partial<SwimLaneLayout>): SwimLaneLayout

- #### Parameters

  - ##### `Optional` init: Partial<SwimLaneLayout>

  #### Returns SwimLaneLayout

## Accessors

### `Protected` `Readonly` laneBreadths
: Map<string, number>

- The computed breadths (widths or heights depending on the direction) of each lane, in the form of a go.Map mapping lane names (strings) to numbers.

### laneComparer
: ((a: string, b: string) => number)

- Gets or sets a function by which to compare lane names, for ordering the lanes within the laneNames Array. By default the function is null -- the lanes are not sorted.

### laneNames
: string[]

- Gets or sets an Array of lane names. If you set this before a layout happens, it will use those lanes in that order. Any additional lane names that it discovers will be added to the end of this Array.

  This property is reset to an empty Array at the end of each layout. The default value is an empty Array.

### `Protected` `Readonly` lanePositions
: Map<string, number>

- The computed positions of each lane, in the form of a go.Map mapping lane names (strings) to numbers.

### laneProperty
: string | ((d: any) => string)

- Gets or sets the name of the data property that holds the string which is the name of the lane that the node should be in. The default value is "lane".

### laneSpacing
: number

- Gets or sets the amount of additional space it allocates between the lanes. This number specifies the number of columns, with the same meaning as go.LayeredDigraphLayout.columnSpacing. The number unit is not in document coordinate or pixels. The default value is zero columns.

## Methods

### computeMinLaneWidth

- computeMinLaneWidth(lane: string): number

- Return the minimum lane width, in columns

  #### Parameters

  - ##### lane: string

  #### Returns number

### `Protected` findLane

- findLane(v: LayeredDigraphVertex): string

- This is just like getLane but handles dummy vertexes for which the getLane returns null by returning the lane of the edge's source or destination vertex. This can only be called after the lanes have been set up internally.

  #### Parameters

  - ##### v: LayeredDigraphVertex

  #### Returns string

### `Protected` getLane

- getLane(v: LayeredDigraphVertex): string

- Given a vertex, get the lane (name) that its node belongs in. If the lane appears to be undefined, this returns the empty string. For dummy vertexes (with no node) this will return null.

  #### Parameters

  - ##### v: LayeredDigraphVertex

  #### Returns string

Copyright © 1998-2024 by Northwoods Software Corporation.