Black Lives Matter. Please consider donating to Black Girls Code today.

Dynamically changing metrics for a figure aka dynamically picking the y axis from a list of dataframe columns

I have three different columns in a dataframe that I would like to use to dynamically define my y axis in several charts.

I have built a drop down that lists the 3 columns to choose from, i.e. Revenue, Cost, and Profit.

How do I pass the output of the drop down in order to define my y axis?

Any help would be appreciated.

Hi @Jfrick100 you will need to write a callback with takes as input the value of the dropdown, and as output the figure property of the different dcc.Graph you wish to update. Inside the callback, you need to create the different plotly figures, defining in particular the y axis. For Dash callbacks see for example https://dash.plot.ly/getting-started-part-2, the second example has a slider which updates a graph.