forked from cytoscape/js-perf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcyjs-2.6-eles10000.html
70 lines (60 loc) · 1.86 KB
/
cyjs-2.6-eles10000.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
<!DOCTYPE html>
<html>
<head>
<title>Cytoscape.js 2.6 (10,000 elements)</title>
<style>
html, body { margin: 0; padding: 0; font: 12pt helvetica neue, helvetica, liberation sans, sans-serif; line-height: 1; }
h1 { position: absolute; left: 0; top: 0; pointer-events: none; font-weight: normal; font-size: 1em; margin: 0.5em; color: #888; }
#cy { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
</style>
<script src="bluebird.min.js"></script>
<script src="fetch.js"></script>
<script src="cytoscape-2.6.12.min.js"></script>
<script>
var domReady = new Promise(function( resolve ){
window.addEventListener('DOMContentLoaded', function(){
resolve();
});
});
var getGraph = function(){
var file = './NB_selected_edges_2_10000.json';
return fetch( file ).then(function( response ){
return response.json();
}).then(function( json ){
return json.elements;
});
};
var initCy = function(){
return cytoscape({
container: document.getElementById('cy'),
elements: getGraph(),
layout: { name: 'preset' },
style: [
{
selector: 'node',
style: {
'label': 'data(label)',
'background-color': '#aaa'
}
},
{
selector: 'edge',
style: {
'opacity': 0.2,
'line-color': '#ccc',
'width': 3
}
}
]
});
};
domReady.then( initCy ).then(function( cy ){
window.cy = cy; // put it in the window so you can play with the instance
});
</script>
</head>
<body>
<h1>Cytoscape.js 2.6 (10,000 elements)</h1>
<div id="cy"></div>
</body>
</html>