-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
component.html
75 lines (71 loc) · 1.98 KB
/
component.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<html>
<head>
<title>Sample</title>
<style>
#app {
width: 600px;
height: 400px;
display: block;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/cytoscape"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-layers"></script>
<script src="../build/index.umd.js"></script>
<script>
const cy = cytoscape({
container: document.getElementById('app'), // container to render in
boxSelectionEnabled: false,
style: [
{
selector: 'node',
css: {
content: 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
},
},
{
selector: ':parent',
css: {
'text-valign': 'top',
'text-halign': 'center',
},
},
{
selector: 'edge',
css: {
'curve-style': 'bezier',
'target-arrow-shape': 'triangle',
},
},
],
elements: {
nodes: [
{ data: { id: 'a', parent: 'b' }, position: { x: 215, y: 85 } },
{ data: { id: 'b' } },
{ data: { id: 'c', parent: 'b' }, position: { x: 300, y: 85 } },
{ data: { id: 'd' }, position: { x: 215, y: 175 } },
{ data: { id: 'e' } },
{ data: { id: 'f', parent: 'e' }, position: { x: 300, y: 175 } },
],
edges: [{ data: { id: 'ad', source: 'a', target: 'd' } }, { data: { id: 'eb', source: 'e', target: 'b' } }],
},
layout: {
name: 'preset',
padding: 5,
},
});
cy.ready(() => {
const bb = cy.bubbleSets();
const nodes = cy.nodes('#a, #d, #f');
bb.addPath(nodes, undefined, cy.nodes('#c'), {
drawPotentialArea: true,
});
});
</script>
</body>
</html>