Create a button to sort a bar chart

Hi, I wanted to create a button on front window which will help to sort the bar chart either ascending or descending…

Create a button which will be connected to the figure property of your dcc.Graph via a callback,
if the button is clicked i.e if n_clicks you can return a figure with sorted values from your df df.sort_values(by='col_name', ascending='True') or False for descending order.
Or you can try setting the autorange property of your yaxis to “reversed” and bars will be arranged in the reverse order. The autorange property is set to True by default.