Skip to content

eles.labelBoundingBox()

eles.labelBoundingBox — Collection > Position and dimensions. Cytoscape.js signatures, parameters and return contract.

eles.labelBoundingBox — Collection › Position and dimensions

Preview · Collection › Position and dimensions

Read in the complete API reference · All API members

// The exact laid label boxes of this collection's elements, unioned: node labels at their anchors, edge mid-labels at the drawn midpoint, end labels conservatively about their endpoint
eles.labelBoundingBox(): { x1: number; y1: number; x2: number; y2: number; w: number; h: number; }

The exact laid label boxes of this collection's elements, unioned: node labels at their anchors, edge mid-labels at the drawn midpoint, end labels conservatively about their endpoint. Empty (zero) when nothing is labelled. Headless dims are estimates (recorded).

Returns { x1: number; y1: number; x2: number; y2: number; w: number; h: number; }

Example

console.log(cy.nodes().labelBoundingBox().w); // 0

Example graph and handle setup