Hi
I have been testing out the Cytoscape component with Dropdown menu filter.
It seems like that cytoscape doesn’t get output via callback such a figure type.
Goal is to filter cytoscape chart with dropdown menu.
Can any one help me this?
Jake
Hi
I have been testing out the Cytoscape component with Dropdown menu filter.
It seems like that cytoscape doesn’t get output via callback such a figure type.
Goal is to filter cytoscape chart with dropdown menu.
Can any one help me this?
Jake
hi @youmin817
Welcome back to the Community,
What if you create a callback where the value of the dropdown (Input) triggers the callback function. And then, inside the callback function you filter the nodes and edges, according to the dropdown value selected; then you return the Cytoscape elements. Something like this:
#pre-built cytoscape
cyto.Cytoscape(
id='cytoscape1',
elements=elements
)
@app.callback(
Output('cytoscape1', 'elements'),
Input('dropdown', 'value')
)
def update_cytoscape_graph(value):
nodes = [filter_data based on value...]
edges = [filter_data based on value...]
new_elements = nodes + edges
return new_elements
It’s great. I was trying that one. It seemed it’s not working. Based on your answer, I found my code error. Thanks,!!