Skip to content

Emphasis

Emphasize a neighbourhood through core-owned view state.

#cy.emphasize(eles)

// Emphasize the given elements and dim the rest of the graph
cy.emphasize(eles: Collection): this

Emphasize the given elements and dim the rest of the graph. Use a node's neighbourhood to highlight a local part of the network.

Emphasized elements match { emphasized: true } in queries and style conditions. The rest are composited using the core's dim-opacity (default 0.15), while emphasized elements appear above them at full opacity. Dimming does not change individual element style values.

Parameters
NameDescription
eles: Collection

the elements to emphasize, from this instance

Returns this

this core, for chaining

Example

cy.emphasize(cy.getElementById('a').closedNeighborhood());
console.log(cy.getElementById('b').emphasized()); // true

Example graph and handle setup

Throws

when eles is not a collection, or is one from another instance

#cy.unemphasize()

// End the emphasis: clear the emphasized set and stop dimming
cy.unemphasize(): this

End the emphasis: clear the emphasized set and stop dimming. A no-op when no emphasis is set.

Returns this

this core, for chaining

Example

cy.emphasize(cy.getElementById('a'));
cy.unemphasize();
console.log(cy.getElementById('a').emphasized()); // false

Example graph and handle setup

All guides · Alphabetical API index · Read continuously