Skip to content

ele.layoutDimensions(options?)

eles.layoutDimensions — Collection > Layout. Cytoscape.js signatures, parameters and return contract.

eles.layoutDimensions — Collection › Layout

Preview · Collection › Layout

Read in the complete API reference · All API members

// Node dimensions for layout spacing — the body, plus the label box under nodeDimensionsIncludeLabels: true (body-only by default)
ele.layoutDimensions(options?: { nodeDimensionsIncludeLabels?: boolean }): { w: number; h: number; }

Node dimensions for layout spacing — the body, plus the label box under nodeDimensionsIncludeLabels: true (body-only by default).

Parameters
NameDescription
options: { nodeDimensionsIncludeLabels?: boolean }?Default: {}

{ nodeDimensionsIncludeLabels: true } to include the label box

Fields of options
NameDescription
nodeDimensionsIncludeLabels: boolean?
Returns { w: number; h: number; }

the first element's { w, h }

Example

console.log(cy.nodes().first().layoutDimensions()); // { w: 30, h: 30 }

Example graph and handle setup