Hi,
I just came up with an idea to append a custom user_data to the elements of Cytoscape.
basic_elements = [
{
"data": {"id": "FAN", "label": "Fan \n Sound Power Level"},
"classes": "FAN",
"user_data": {"id": "fan", "units": "metric", "IL": [2, 3, 4, 5, 6, 7, 8]},
},
{"data": {"source": "FAN", "target": "Duct", "label": "Edge from Node1 to Node2"}},
{"data": {"id": "Duct", "label": "Duct"}, "classes": "DUCT"},
{"data": {"id": "Branch", "label": "Branch"}, "classes": "BRANCH"},
}]
and
cyto.Cytoscape(
id="cytoscape",
elements=basic_elements,
stylesheet=cytoscape_stylesheet,
style={
"height": "95vh",
"width": "100%",
"background-color": "#f5f5fa",
},
userZoomingEnabled=False,
autoRefreshLayout=True,
)
I use the user_data in the callbacks to store the struct containing analysis data associated with each node. It works well now. I was wondering if this would break in the future - i.e. elements NOT accepting unregistered fields.
Thanks,
Vivek