-
Notifications
You must be signed in to change notification settings - Fork 35
/
demo.html
119 lines (103 loc) · 2.66 KB
/
demo.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE>
<html>
<head>
<title>[jquery.cytoscape.js-qtip.js] Cytoscape.js qTip</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.css">
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.js"></script>
<script src="http://cytoscape.github.io/cytoscape.js/api/cytoscape.js-latest/cytoscape.min.js"></script>
<!--<script src="../cytoscape.js/build/cytoscape.js"></script>-->
<script src="jquery.cytoscape.js-qtip.js"></script>
<style>
body {
font-family: helvetica;
font-size: 14px;
}
#cy {
width: 600px;
height: 600px;
border: 1px solid #888;
}
</style>
<script>
$(function(){
$('#cy').cytoscape({
ready: function(){
window.cy = this;
// just use the regular qtip api but on cy elements
cy.elements().qtip({
content: 'Example qTip on ele',
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-bootstrap',
tip: {
width: 16,
height: 8
}
}
});
// call on core
cy.qtip({
content: 'Example qTip on core bg',
position: {
my: 'top center',
at: 'bottom center'
},
show: {
cyBgOnly: true
},
style: {
classes: 'qtip-bootstrap',
tip: {
width: 16,
height: 8
}
}
});
},
style: [
{
selector: 'node',
css: {
'content': 'data(name)'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
}
],
elements: {
nodes: [
{ data: { id: 'j', name: 'Jerry' } },
{ data: { id: 'e', name: 'Elaine' } },
{ data: { id: 'k', name: 'Kramer' } },
{ data: { id: 'g', name: 'George' } }
],
edges: [
{ data: { source: 'j', target: 'e' } },
{ data: { source: 'j', target: 'k' } },
{ data: { source: 'j', target: 'g' } },
{ data: { source: 'e', target: 'j' } },
{ data: { source: 'e', target: 'k' } },
{ data: { source: 'k', target: 'j' } },
{ data: { source: 'k', target: 'e' } },
{ data: { source: 'k', target: 'g' } },
{ data: { source: 'g', target: 'j' } }
]
},
});
});
</script>
</head>
<body>
<h1>[jquery.cytoscape.js-qtip.js] Cytoscape.js qTip Demo</h1>
<div id="cy"></div>
</body>
</html>