-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
40 lines (30 loc) · 852 Bytes
/
code.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
var dataArray = [cyStyle, graphData];
document.addEventListener("DOMContentLoaded", function() {
var cy = window.cy = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'cose',
idealEdgeLength: 100,
nodeOverlap: 20,
refresh: 20,
fit: true,
padding: 30,
randomize: false,
componentSpacing: 100,
nodeRepulsion: graphData.length * 600,
edgeElasticity: 100,
nestingFactor: 5,
gravity: 160,
numIter: 1000,
initialTemp: 15000,
coolingFactor: 0.95,
minTemp: 1.0
},
style: dataArray[0],
elements: dataArray[1]
});
cy.center()
cy.fit()
const sourceHTML = graphSources.map(source => `<tr>${source}</tr><br>`).join("")
document.getElementById('sourceAnchor').innerHTML = `<table>${sourceHTML}</table>`
})