Skip to content

@graphty/graphty-element / extend / LayoutDefinition

Interface: LayoutDefinition<O> ​

Defined in: graphty-element/src/simple/types.ts:332

What defineLayout takes: an id, options in short form and place.

Extends ​

Type Parameters ​

O ​

O extends OptionsShorthand

Properties ​

description? ​

readonly optional description?: string

Defined in: graphty-element/src/simple/types.ts:87

One sentence for pickers and the catalogue. Default: "".

Inherited from ​

DefinitionBase.description


dimensions? ​

readonly optional dimensions?: 2 | 3

Defined in: graphty-element/src/simple/types.ts:334

The most dimensions the layout uses. Default 3.


id ​

readonly id: string

Defined in: graphty-element/src/simple/types.ts:83

Permanent id: lower case, hyphenated, vendor-prefixed ("acme-hop-reach"). Kept unchanged when the extension graduates.

Inherited from ​

DefinitionBase.id


name? ​

readonly optional name?: string

Defined in: graphty-element/src/simple/types.ts:85

What pickers show. Default: the id in sentence case ("acme-hop-reach" reads "Acme hop reach").

Inherited from ​

DefinitionBase.name


options? ​

readonly optional options?: O

Defined in: graphty-element/src/simple/types.ts:89

The options a reader may set, in short form: { spacing: 2, weight: { type: "attribute", on: "edge" } }.

Inherited from ​

DefinitionBase.options


place ​

readonly place: (graph, context) => ReadonlyMap<NodeId, Point | null> | Promise<ReadonlyMap<NodeId, Point | null>>

Defined in: graphty-element/src/simple/types.ts:343

Where each node goes, in scene units (a node at the default size is 1 unit across; +x is right and +y is up, as in the scene). A node missing from the map, or mapped to null or to a non-finite number, is UNPLACED. A value for a pinned or held node is ignored.

Parameters ​

graph ​

GraphView

context ​

LayoutContext<OptionValuesOf<O>>

Returns ​

ReadonlyMap<NodeId, Point | null> | Promise<ReadonlyMap<NodeId, Point | null>>


random? ​

readonly optional random?: boolean

Defined in: graphty-element/src/simple/types.ts:336

True when the result should change from run to run; the element then draws and records a seed.


version? ​

readonly optional version?: string

Defined in: graphty-element/src/simple/types.ts:91

The extension's own semver version, recorded as provenance.

Inherited from ​

DefinitionBase.version