@graphty/graphty-element / session / SessionLayout
Interface: SessionLayout ​
Defined in: graphty-element/src/session/types.ts:1749
Which layout draws the graph, and in how many dimensions: the project's layout slice.
Choosing a layout and switching between 2D and 3D are undoable steps, and undo puts back the engine that was chosen with its own options, not the catalogue's default. Until one is chosen it reads the element's default, the force layout drawn by ngraph in 3D.
Properties ​
dimension ​
readonlydimension:"2d"|"3d"
Defined in: graphty-element/src/session/types.ts:1757
Whether the graph is drawn in two dimensions or three.
engine ​
readonlyengine:string
Defined in: graphty-element/src/session/types.ts:1753
The engine that draws it, such as "d3".
id ​
readonlyid:LayoutId
Defined in: graphty-element/src/session/types.ts:1751
The catalogue id, such as "force".
options ​
readonlyoptions:Readonly<Record<string,unknown>>
Defined in: graphty-element/src/session/types.ts:1755
The options it was chosen with.
Methods ​
set() ​
set(
id,options?):Promise<void>
Defined in: graphty-element/src/session/types.ts:1768
Choose the layout. One step.
Parameters ​
id ​
The catalogue id; a registered engine name is read as the id it serves.
options? ​
The engine, when not the catalogue's default for id, and its options.
engine? ​
string
The engine that draws it, such as "d3".
options? ​
Readonly<Record<string, unknown>>
The engine's options.
Returns ​
Promise<void>
Settles once the step is recorded and the layout has taken its pre-steps.
Throws ​
A GraphtyError (as a rejection) with E_UNKNOWN_LAYOUT, E_UNKNOWN_OPTION or E_OPTION_RANGE when the renderer cannot build it; nothing is changed then.
setDimension() ​
setDimension(
dimension):Promise<void>
Defined in: graphty-element/src/session/types.ts:1777
Draw in 2D or 3D. One step; nothing is recorded when the graph is drawn so already.
Parameters ​
dimension ​
"2d" | "3d"
Which.
Returns ​
Promise<void>
Settles once the step is recorded and the layout has been rebuilt for it.