如何在图形中显示多个节点内容(Cytoscape样式表)

how to show multiple node content in graph (Cytoscape stylesheet)

本文关键字:Cytoscape 样式 节点 图形 显示      更新时间:2023-09-26

我想显示与节点关联的两个节点内容(节点 ID 和节点名称)。以下代码重写第一种样式。我们如何在图形中显示多个内容。

 style: cytoscape.stylesheet()
 .selector('node')
  .css({
    'content': 'data(name)',
    'text-valign': 'center',
     'text-halign': 'center',
     })
  .selector('node')
   .css({
    'content': 'data(id)',
    'text-valign': 'top',
     'text-halign': 'center',
     })

如果您不想覆盖第二个节点,则需要在第二个节点上使用不同的选择器。