-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.gohtml
260 lines (234 loc) · 8.66 KB
/
index.gohtml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!DOCTYPE>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Go call graph</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<script src="https://unpkg.com/cytoscape/dist/cytoscape.min.js"></script>
<script src="https://unpkg.com/[email protected]/cytoscape-cose-bilkent.js"></script>
<style>
body {
font-family: helvetica, serif;
font-size: 14px;
}
#cy {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.overlay {
position: absolute;
z-index: 10;
}
#info {
left: 0;
top: 0;
margin: 10px;
}
#pkg-list {
font-family: monospace;
color: black;
opacity: 0.7;
}
#gocyto-link {
position: absolute;
margin: 10px;
left: 0;
bottom: 0;
opacity: 0.5;
font-size: 1em;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
window.cy = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'cose-bilkent',
// Whether to include labels in node dimensions. Useful for avoiding label overlap
nodeDimensionsIncludeLabels: true,
// number of ticks per frame; higher is faster but more jerky
refresh: 30,
// Whether to fit the network view after when done
fit: true,
// Padding on fit
padding: 30,
// Whether to enable incremental mode
randomize: true,
// Node repulsion (non overlapping) multiplier
nodeRepulsion: 1000,
// Ideal (intra-graph) edge length
idealEdgeLength: 40,
// Divisor to compute edge forces
edgeElasticity: 0.3,
// Nesting factor (multiplier) to compute ideal edge length for inter-graph edges
nestingFactor: 0.03,
// Gravity force (constant)
gravity: 0.15,
// Maximum number of iterations to perform
numIter: 5000,
// Whether to tile disconnected nodes
tile: true,
// Type of layout animation. The option set is {'during', 'end', false}
animate: 'end',
// Amount of vertical space to put between degree zero nodes during tiling (can also be a function)
tilingPaddingVertical: 30,
// Amount of horizontal space to put between degree zero nodes during tiling (can also be a function)
tilingPaddingHorizontal: 30,
// Gravity range (constant) for compounds
gravityRangeCompound: 1.0,
// Gravity force (constant) for compounds
gravityCompound: 0.08,
// Gravity range (constant)
gravityRange: 2.0,
// Initial cooling factor for incremental layout
initialEnergyOnIncremental: 0.9
},
style: [
{
selector: 'core',
style: {
"active-bg-opacity": 0.3,
"active-bg-color": "#ff0",
}
},
{
selector: 'node',
style: {
'shape': 'tag',
'border-color': '#323232',
'border-opacity': 0.7,
'border-width': 1,
'border-style': 'solid',
"font-weight": 300
}
},
{
selector: 'node[color]',
style: {
'shape': 'tag',
'background-color': 'data(color)'
}
},
{
selector: 'node.global',
style: {
'shape': 'ellipse'
}
},
{
selector: 'node.unexported',
style: {
'border-color': '#323232',
'border-opacity': 0.6,
'border-width': 2,
'border-style': 'dashed'
}
},
{
selector: 'node[label]',
style: {
label: "data(label)",
"font-family": "monospace"
}
},
{
selector: 'node:parent',
style: {
'background-opacity': 0.333,
'border-width': 0,
'border-opacity': 0,
},
},
{
selector: 'node.package',
style: {
'font-style': "italic",
"font-weight": 700
},
},
{
selector: 'node.type',
style: {
"font-weight": 700
},
},
{
selector: 'node:parent',
style: {
'compound-sizing-wrt-labels': 'include'
},
},
{
selector: 'edge',
style: {
'line-color': '#a12b87',
'curve-style': "straight",
"target-arrow-shape": "vee",
"target-arrow-color": "#a12b87",
"arrow-scale": 1.5,
},
},
{
selector: 'edge.function',
style: {
"curve-style": "bezier"
}
},
{
selector: 'edge.concurrent',
style: {
"mid-target-arrow-shape": "triangle-tee",
}
},
{
selector: 'edge.deferred',
style: {
"mid-target-arrow-shape": "diamond",
}
},
{
selector: 'edge.closure',
style: {
"line-style": "dashed",
"line-dash-pattern": [6, 6],
}
},
{
selector: 'edge.static',
style: {
'line-color': '#ef60f9',
"target-arrow-color": "#ef60f9",
}
},
{
selector: 'edge.dynamic',
style: {
'line-color': '#5ece5c',
"target-arrow-color": "#5ece5c",
}
},
{
selector: 'edge.method',
style: {
'line-color': '#64a1a0',
"target-arrow-color": "#64a1a0",
}
},
],
elements: {{.GraphJSON}}
});
});
</script>
</head>
<body>
<div id="info" class="overlay">
<pre id="pkg-list">{{.Packages}}</pre>
</div>
<h2 id="gocyto-link" class="overlay"><a href="https://github.com/protolambda/gocyto">Gocyto</a> callgraph</h2>
<div id="cy"></div>
</body>
</html>