-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathusage-grid-layout.py
55 lines (48 loc) · 1.29 KB
/
usage-grid-layout.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
"""
Original Demo: http://js.cytoscape.org/demos/grid-layout/
"""
import json
import dash
from dash import html
import dash_cytoscape as cyto
app = dash.Dash(__name__)
server = app.server
# Load Data
with open("data/grid-layout/data.json", "r", encoding="utf-8") as f:
elements = json.loads(f.read())
# App
app.layout = html.Div(
[
cyto.Cytoscape(
id="cytoscape",
elements=elements,
layout={"name": "grid"},
stylesheet=[
{
"selector": "node",
"style": {"height": 20, "width": 20, "background-color": "#18e018"},
},
{
"selector": "edge",
"style": {
"curve-style": "haystack",
"haystack-radius": 0,
"width": 5,
"opacity": 0.5,
"line-color": "#a2efa2",
},
},
],
style={
"width": "100%",
"height": "100%",
"position": "absolute",
"left": 0,
"top": 0,
"z-index": 999,
},
)
]
)
if __name__ == "__main__":
app.run(debug=True)