Plotly Animation using dcc.Intervals and Sliders to animate the chart using fig.frames

Hello guys,

I’m trying to build an px.bar animation, but instead of using the plotly animation, I’m trying to control and do the transition using an Interval and a slider… It’s working well, as the gif below shows when I set the slider to another value, it keeps by the last value based on the value of the interval…

I’m failing in make the chart ever go ahead based on the

The structure of callbacks at this moment is:

And the callbacks on the application
image

I need to find a way to iterate the sliders from 0 to 23 and if someone set a customized value on the slider, it starts from the last value on the slider;

PS: I’m using the Intervals because I have a “stop and play” button that triggers the disabled property of intervals;

If it isn’t clear, please let me know if I can provide more information

Best regards,
Leonardo

You could use the following callback:

@app.callback(
    Output("slider-vals", "value"),
    [Input("interval", "n_intervals")],
    [State("slider-vals", "value")]
)
def display_count_hidden(n, value):
    value = value or 0
    return (value + 1) % 24
2 Likes

It worked perfectly, @RenaudLN; Thank you so much bro!!!