Skip to main content

BowtieLayout

Places the focus vertex in the center of the canvas and then branches out to the left and right - or top and bottom - with children of the focus. You are expected to supply a getUpstream and getDownstream function for this layout, as well as either getRootNode or rootNode. getUpstream is used to get the immediate children of the focus vertex that will be painted to the left or above, depending on axis. getDownstream is used to get the immediate children of the focus vertex that will be painted to the right or below. By default this layout will draw horizontally, which you can change by setting axis:"vertical".

Extends

Methods

begin()

begin(dataSource, positionGetter, positionSetter, sizes, parameters): void

This is an abstract function that subclasses may implement if they wish. It will be called at the beginning of a layout.

Parameters

dataSource

DataSource

The associated dataSource

positionGetter

(id) => PointXY

Function to get position for some element

positionSetter

(id, x, y) => void

Function to set position for some element. Updates current extents as it sets the position.

sizes

Record<string, Size>

Map of element sizes.

parameters

CircularLayoutParameters

Parameters configured for the layout.

Returns

void

Overrides

AbstractLayout.begin


end()

end(dataSource, getPosition, setPosition, sizes, parameters): void

This is an abstract function that subclasses may implement if they wish. It will be called at the end of a layout.

Parameters

dataSource

DataSource

The associated VisuallyJs model

getPosition

(id) => PointXY

setPosition

(id, x, y) => void

sizes

Record<string, Size>

Map of element sizes.

parameters

BowtieLayoutParameters

Parameters configured for the layout.

Returns

void

Overrides

AbstractLayout.end


step()

step(dataSource, getPosition, setPosition, sizes, parameters): void

Step through the layout. For some layouts there is only a single step, but others continue stepping until some condition is met. Once the condition is met, the subclass must set this.done = true, or the layout will continue looping indefinitely.

Parameters

dataSource

DataSource

The associated VisuallyJs model

getPosition

(id) => PointXY

setPosition

(id, x, y) => void

sizes

Record<string, Size>

parameters

BowtieLayoutParameters

Parameters configured for the layout.

Returns

void

Overrides

AbstractLayout.step