better selection
This commit is contained in:
29
ratios.py
29
ratios.py
@@ -21,12 +21,39 @@ for col in columns_to_summarize:
|
||||
|
||||
# Customize the layout
|
||||
fig.update_layout(
|
||||
title="Summary of Categories by Place with Filtering",
|
||||
title="Summary of Categories by Place with Selection",
|
||||
xaxis_title="Place",
|
||||
yaxis_title="Total Count",
|
||||
xaxis=dict(categoryorder='total descending'),
|
||||
barmode='group'
|
||||
)
|
||||
|
||||
# Enable selection by clicking
|
||||
fig.update_traces(selector=dict(mode='lasso'))
|
||||
|
||||
# Enable searching for place names
|
||||
fig.update_layout(updatemenus=[
|
||||
{
|
||||
'buttons': [
|
||||
{
|
||||
'args': [{'visible': [True] * len(grouped)}],
|
||||
'label': 'Show All',
|
||||
'method': 'restyle'
|
||||
},
|
||||
{
|
||||
'args': [{'visible': [grouped["place"] == place for place in grouped["place"]]}],
|
||||
'label': 'Select Place',
|
||||
'method': 'restyle'
|
||||
}
|
||||
],
|
||||
'direction': 'down',
|
||||
'showactive': False,
|
||||
'x': 0.1,
|
||||
'xanchor': 'left',
|
||||
'y': 1.1,
|
||||
'yanchor': 'top'
|
||||
}
|
||||
])
|
||||
|
||||
# Show the interactive graph
|
||||
fig.show()
|
||||
|
Reference in New Issue
Block a user