I have the following fields as my nodes data:
nodes {
data: {id: "something", type: "human"}
data: {id: "somethingElse", type: "mouse"}
}
Is there any way to set the shapes of the nodes based on the type
in data
?
I have the following fields as my nodes data:
nodes {
data: {id: "something", type: "human"}
data: {id: "somethingElse", type: "mouse"}
}
Is there any way to set the shapes of the nodes based on the type
in data
?
You can structure the cytoscape style element and selectors, like in the code snippet below:
style: [
{
selector: 'node[type="human"]',
style: {
'shape': 'triangle',
'background-color': 'red'
}
},
{
selector: 'node[type="mouse"]',
style: {
'shape': 'square',
'background-color': 'blue'
}
}
]
Use a stylesheet with appropriate selectors, e.g.:
node[type = 'foo'] {
background-color: red;
shape: star;
/* ... */
}
© 2022 - 2024 — McMap. All rights reserved.