使用 Cytoscape.js 添加边缘标签 [英] Add an edge label with Cytoscape.js

查看:52
本文介绍了使用 Cytoscape.js 添加边缘标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Cytoscape.js 在边缘添加标签?

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

推荐答案

label 样式属性映射到数据字段:

Map the label style property to a data field:

例如在 init 的样式表中

e.g. in the stylesheet on init

...

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

...

http://cytoscape.github.com/cytoscape.js/#style/属性

旧版本使用 content: 代替 label:.较新版本的 2.x 允许 labelcontent 以实现向后兼容性.

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

这篇关于使用 Cytoscape.js 添加边缘标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆