2016-03-27 183 views

回答

2

使用stylesheet适当selectors,如:

node[type = 'foo'] { 
    background-color: red; 
    shape: star; 
    /* ... */ 
} 
+0

是自定义形状可能? –

+1

您可以指定自定义多边形:http://js.cytoscape.org/#style/node-body – maxkfranz

2

可以结构Cytoscape的风格元素和选择,如下面的代码片段:

style: [ 
    { 
    selector: 'node[type="human"]', 
    style: { 
     'shape': 'triangle', 
     'background-color': 'red' 
    } 
    }, 
    { 
    selector: 'node[type="mouse"]', 
    style: { 
     'shape': 'square', 
     'background-color': 'blue' 
    } 
    } 
]