Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add an edge label with Cytoscape.js

How can I add a label on an edge using Cytoscape.js?

like image 513
user2126217 Avatar asked Mar 02 '13 08:03

user2126217


1 Answers

Map the label style property to a data field:

e.g. in the stylesheet on init

...  {   selector: 'edge',   style: {     'label': 'data(label)' // maps to data.label   } }   ... 

http://cytoscape.github.com/cytoscape.js/#style/properties

Older versions use content: in place of label:. Newer versions of 2.x allow label and also content for backwards compatibility.

like image 60
maxkfranz Avatar answered Sep 26 '22 10:09

maxkfranz