Skip to content

Commit

Permalink
feat(enhance_ui): button to export agent network display as png
Browse files Browse the repository at this point in the history
  • Loading branch information
bangxiangyong committed Apr 28, 2021
1 parent f619563 commit 3b41610
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions agentMET4FOF/dashboard/Dashboard_agt_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def get_layout(self):
html.Div(className="col", children=[
LayoutHelper.html_button(icon="restore", text="Reset", id="reset-button")
]),
html.Div(className="col", children=[
LayoutHelper.html_button(icon="restore", text="Export JPG", id="cyto-button-export")
]),
])

]),
Expand Down Expand Up @@ -141,6 +144,17 @@ def get_layout(self):
])

def prepare_callbacks(self, app):

@app.callback([dash.dependencies.Output('agents-network', 'generateImage')],
[dash.dependencies.Input('cyto-button-export', 'n_clicks')],
)
def export_image(n_clicks):
if (n_clicks is not None):
return [{
'type': "png",
'action': "download"
}]

# Update network graph per interval
@app.callback([dash.dependencies.Output('agents-network', 'elements'),
dash.dependencies.Output('connect-modules-dropdown', 'options')],
Expand Down

0 comments on commit 3b41610

Please sign in to comment.