Skip to content

cy.legend()

cy.legend — Core > Style and legends. Cytoscape.js signatures, parameters and return contract.

cy.legend — Core › Style and legends

Preview · Core › Style and legends

Read in the complete API reference · All API members

// Read the application's shared mapping and chart metadata
cy.legend(): Legend

Read the application's shared mapping and chart metadata. The returned JSON object is detached; changing it never alters this instance. Automatic domains expose their authored auto stops in the stylesheet and their current numeric stops here. legendchange fires after a committed snapshot changes, before batchend for a batch.

Returns Legend

detached legend entries in stylesheet definition/property order

Example

console.log(cy.legend().entries.length); // 0

Example graph and handle setup