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

Plotly chart with dynamic dropdown list

I have created several plotly charts using dropdown list filters to filter the dataset. This works fine but the number of items in the dropdown list is hardcoded. What if the data is updated and another option is available to filter the data. For example, see the code below. Is there a dynamic way of assigning the list to the buttons just in case a 4th option becomes available which can automatically be included in the dropdown list? Some form of for iteration or apply function might be needed?

Example code can be seen in the followed link

1 Like