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

Replay Plotly Slider

Hi there,

I am currently trying to get my plotly slider to replay on an automated loop.

I have the following code:

gd.on('plotly_sliderchange', function(e){
         if(e.step.label == yearMax)
              {

              }
    }); 

The logic here is when the slider reaches the last year/time event to do something. I would like at this point to restart and play the slider from the beginning. However I currently can’t find any logic on how to do this all through code.

Has anyone done this before?

Thanks!

1 Like

Have you tried:

gd.on('plotly_sliderchange', function(e){
         if(e.step.label == yearMax)
              {
                  Plotly.animate(gd)
              }
    }); 

Thank you @etienne! This worked perfectly!