multi labels cytoscape js

2019-08-09 20:13发布

I'd like use two labels per node using cytoscape.js. One inside and another outside of the node, like this link image http://gcuculi.com/imagens/labels-constelation.png.

I used qtip for external labels, but I need to print (ctrl+p) this page and qtip div positions are absolute (from document), so they don't appear in right place.

There is a way to modify cytoscape.js for two labels or how I prevent qtip from this behavior?

Tks!!

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-09 20:41

One way to get multiple distinct labels is to use compound nodes, i.e. nodes that contain other nodes via a parent-child relationship.

If you gave every node its own parent node, you could provide different labels for the child and parent nodes and they would always appear together.

Node definitions with this representation might look like this:

[
  { data: { id: 'childId', parent: 'parentId' } },
  { data: { id: 'parentId' } }
]
查看更多
登录 后发表回答