问题
I am looking for a software that allows me to draw relations between entities with automatic drawing and with user interaction. I have saw cytoscape.js and it seems like a really good option, but I want to know if with this software you can visualize the name of the relations.
The objetive of the example is to draw two persons and show their relation, for example, that they are brothers.
Person1 ====== brother =====> Person2
Do I need to modify the code to do this?
回答1:
You don't need to modify the code. This functionality is already built in. You will need to know how to use the mappers and cytoscape stylesheet definitions.
If you take a look at the source of the demo that they used here, you'll see that when you're defining the cytoscape css style, you need to set the content
attribute which you could then use the mappers and specify which attribute in the node/edge data you'd like to display. This is already done with the id
attribute for nodes as follows:
style: cytoscape.stylesheet()
.selector("node")
.css({
"content": "data(id)",
"shape": "data(shape)",
"border-width": 3,
"background-color": "#DDD",
"border-color": "#555",
})
You can do the exact same for edges Hope this helps.
来源:https://stackoverflow.com/questions/14293474/show-the-kind-of-relation-between-nodes-in-cytoscape-js