How can I add a label on an edge using Cytoscape.js?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.