Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Toggle legendgroup using button

Hi

I have created several plots using plotly and using legendgroup “day” and “month” to control what is
is visible. That works fins even if pressing one, will not render the other “legendonly”

What I would like to do is create 2 interactive buttons, aka one for month and one for day
that upon pressed will render…

Go Day

daybutton.onclick = function() {
legendgroup = “day”
visible = True

            legendgroup = "month"
            visible = "legendonly"

}

Go month

monthbutton.onclick = function() {
legendgroup = “month”
visible = True

            legendgroup = "day"
            visible = "legendonly"

}

Does anyone has some example javascript that is capable of doing this sort of things?
Any tips would be welcome as well.

Cheers