问题
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:
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' } }
]
来源:https://stackoverflow.com/questions/33831483/multi-labels-cytoscape-js