Skip to content

Core

The core owns a graph, its viewport and instance-wide operations.

The core (cy) is the graph, its stylesheet and its viewport. It owns instance-wide data, events, loading, layouts, exports and renderer lifetime. An application creates one core per independent graph/view. cy.clone() makes a second model and renderer when the same graph should appear in another container; it is not a second renderer attached to one mutable store.

#Function categories

  • Initialisation and lifecycle — Construct, mount, inspect readiness and dispose of a core.
  • Graph manipulation — Add, reconcile or progressively load graph data, and batch related writes.
  • Accessing elements — Look up elements by identity, region, query object or predicate.
  • Data and scratch — Keep serializable graph data separate from transient application scratch.
  • Metadata and environment — Inspect core configuration, environment and graph metadata.
  • Events — Bind core listeners or delegate to elements using predicates.
  • Viewport manipulation — Read and change the view without changing model positions.
  • Interaction controls — Control programmatic operations, user gestures and interaction defaults.
  • Emphasis — Emphasize a neighbourhood through core-owned view state.
  • Animation — Animate viewport channels and control running core animations.
  • Layout — Create a whole-graph layout handle; run it explicitly.
  • Style and legends — Apply a declarative stylesheet and inspect its legend.
  • Export and snapshots — Export graph payloads or render a raster image.
  • Independent views — Clone into an independent core with its own renderer and interaction state.
Links from earlier versions of this guide

Initialisation and lifecycle

cytoscape()

cy.ready()

cy.isReady()

cy.unmount()

cy.mount()

cy.container()

cy.destroy()

cy.destroyed()

Graph manipulation

Adding, removing and reconciling

cy.add()

cy.remove()

cy.patch()

Progressive loading

cy.load()

Batching and compaction

cy.compact()

cy.startBatch()

cy.endBatch()

cy.batch()

Accessing elements

cy.collection()

cy.getElementById()

cy.elements()

cy.nodes()

cy.edges()

cy.filter()

cy.elementsInBox()

Data and scratch

cy.data()

cy.removeData()

cy.scratch()

cy.removeScratch()

Metadata and environment

cy.headless()

cy.styleEnabled()

cy.hasCompoundNodes()

cy.hasElementWithId()

cy.window()

cy.options()

Events

cy.on()

cy.one()

cy.off()

cy.removeAllListeners()

cy.emit()

cy.promiseOn()

Viewport manipulation

Pan, zoom, fit and bounds

cy.zoom()

cy.pan()

cy.panBy()

cy.fit()

cy.center()

cy.extent()

cy.renderedExtent()

cy.size()

cy.minZoom()

cy.maxZoom()

cy.zoomRange()

cy.viewport()

cy.reset()

cy.resize()

cy.width()

cy.height()

Picking and visible counts

cy.pick()

cy.nodeAt()

cy.viewportCounts()

Interaction controls

cy.autolock()

cy.autoungrabify()

cy.autounselectify()

cy.panningEnabled()

cy.userPanningEnabled()

cy.zoomingEnabled()

cy.userZoomingEnabled()

cy.boxSelectionIncludesLabels()

cy.boxSelectionMode()

cy.boxSelectionEnabled()

cy.pointerCursors()

cy.selectionType()

cy.multiClickDebounceTime()

cy.wheelSensitivity()

cy.wheelBehavior()

cy.desktopTapThreshold()

cy.touchTapThreshold()

cy.tapholdDuration()

Emphasis

cy.emphasize()

cy.unemphasize()

Animation

cy.animate()

cy.animation()

cy.animated()

cy.stop()

Layout

cy.layout()

Style and legends

cy.style()

cy.legend()

Export and snapshots

Graph data and wire format

cytoscape.toColumnarElements()

cytoscape.serializeElements()

cytoscape.deserializeElements()

cy.serialize()

cy.json()

Image export

cy.png()

cy.jpg()

Independent views

cy.clone()

All guides · Alphabetical API index · Read continuously