New to Plotly .
Is there a way to check if a callback is triggered?
I believe my callback is not working or is not triggered.
Table
dash_table.DataTable(
id='datatable-id',
columns=[
{ "id": i,
"deletable": False, "selectable": True} for i in df.columns],
data = df.to_dict('records'),
editable=False,
page_action="native",
page_current=0,
page_size=5,
filter_action="native",
sort_action="native",
sort_mode="multi",
style_header={
'backgroundColor': 'rgb(230, 230, 230)',
'fontWeight': 'bold'
},
style_data_conditional=[
{
'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(248, 248, 248)'
}
],
)])
Callback
@app.callback([Output('datatable-id','data'),
Output('datatable-id','columns')],
[Input('dropdown', 'value')]
)
def update_dashboard(filter_type):
if filter_type is None:
raise PreventUpdate
else:
dff = some data call
columns=[{"name": i, "id": i, "deletable": False, "selectable": True} for i in dff.columns]
data=dff.to_dict('records')
return (data,columns)
Th dropdown is able to update the pie chart.
Piechart callback
@app.callback(
Output('graph-id', 'figure'),
[Input('dropdown', 'value')]
)
def update_graph(my_dropdown):
piechart=px.pie(
data_frame=df, names=my_dropdown, hole=.0, title ="Title",
)
return (piechart)
Any help, tips or tricks would be appreciated!