-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathusage-linkout-example.py
66 lines (58 loc) · 1.79 KB
/
usage-linkout-example.py
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
"""
Original Demo: http://js.cytoscape.org/demos/linkout-example/
Note: Href Links do not work
"""
import dash
from dash import html
import dash_cytoscape as cyto
app = dash.Dash(__name__)
server = app.server
elements = [
{"data": {"id": "desktop", "name": "Cytoscape", "href": "http://cytoscape.org"}},
{"data": {"id": "js", "name": "Cytoscape.js", "href": "http://js.cytoscape.org"}},
{"data": {"source": "desktop", "target": "js"}},
]
# App
app.layout = html.Div(
[
cyto.Cytoscape(
id="cytoscape",
elements=elements,
boxSelectionEnabled=False,
autounselectify=True,
layout={"name": "grid", "padding": 10},
stylesheet=[
{
"selector": "node",
"style": {
"content": "data(name)",
"text-valign": "center",
"color": "white",
"text-outline-width": 2,
"text-outline-color": "#888",
"background-color": "#888",
},
},
{
"selector": ":selected",
"style": {
"background-color": "black",
"line-color": "black",
"target-arrow-color": "black",
"source-arrow-color": "black",
"text-outline-color": "black",
},
},
],
style={
"width": "100%",
"height": "100%",
"position": "absolute",
"left": 0,
"top": 0,
},
)
]
)
if __name__ == "__main__":
app.run(debug=True)