-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcytoscape-example.js
62 lines (53 loc) · 1.94 KB
/
cytoscape-example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//http://js.cytoscape.org/
var cy = cytoscape({
container: $('#cy'), // container to render in
elements: [ // list of graph elements to start with
{ data: { id: 'abanico', color:'blue' } },
{ data: { id: 'barco', color:'blue' } },
{ data: { id: 'c', color:'yellow' } },
{ data: { id: 'd', color:'yellow' } },
{ data: { id: 'e', color:'gray' } },
{ data: { id: 'f', color:'gray' } },
{ data: { id: 'g', color:'green' } },
{ data: { id: 'h', color:'green' } },
{ data: { id: 'indeterminadamente', color:'green' } },
{ data: { id: 'ab', source: 'abanico', target: 'barco', label: 'uno', color:'gray'} },
{ data: { id: 'ac', source: 'abanico', target: 'c', label: 'edge', color:'gray'} },
{ data: { id: 'ad', source: 'abanico', target: 'd', label: 'arista', color:'gray'} },
{ data: { id: 'ae', source: 'abanico', target: 'e', label: 'enlace', color:'gray'} },
{ data: { id: 'af', source: 'abanico', target: 'f', label: 'test', color:'green'} },
{ data: { id: 'fg', source: 'f', target: 'g', label: 'dos', color:'red'} },
{ data: { id: 'fh', source: 'f', target: 'h', label: 'tres', color:'blue'} },
{ data: { id: 'fi', source: 'f', target: 'indeterminadamente', label: 'cuatro', color:'yellow'} }
],
style: [ // the stylesheet for the graph
{
selector: 'node',
style: {
'background-color': 'data(color)',
'label': 'data(id)',
'width': 'label',
'shape': 'roundrectangle',
'text-valign': 'center',
'text-halign': 'center',
'padding-left': '0.5em',
'padding-right': '0.5em'
}
},
{
selector: 'edge',
style: {
'width': 3,
'line-color': 'data(color)',
'target-arrow-color': 'data(color)',
'target-arrow-shape': 'triangle',
'target-arrow-fill': 'filled',
'label': 'data(label)'
}
}
],
layout: {
//name: 'spread'
name: 'grid'
}
});