Skip to content

Instantly share code, notes, and snippets.

@ken333135
Created October 31, 2018 04:00
Show Gist options
  • Save ken333135/5b38ebc0f9a87d15fa22c047d6bd8730 to your computer and use it in GitHub Desktop.
Save ken333135/5b38ebc0f9a87d15fa22c047d6bd8730 to your computer and use it in GitHub Desktop.
app.layout = html.Div([
html.Div(dcc.Graph(id='Graph',figure=fig)),
html.Div(className='row', children=[
html.Div([html.H2('Overall Data'),
html.P('Num of nodes: ' + str(len(G.nodes))),
html.P('Num of edges: ' + str(len(G.edges)))],
className='three columns'),
html.Div([
html.H2('Selected Data'),
html.Div(id='selected-data'),
], className='six columns')
])
])
@app.callback(
Output('selected-data', 'children'),
[Input('Graph','selectedData')])
def display_selected_data(selectedData):
num_of_nodes = len(selectedData['points'])
text = [html.P('Num of nodes selected: '+str(num_of_nodes))]
for x in selectedData['points']:
material = int(x['text'].split('<br>')[0][10:])
text.append(html.P(str(material)))
return text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment