How to fix axis range while using dynamic data

Hi

How can I fix the x Axis range in below code when Iā€™m using Dynamic data? When we are using go.FigureWidget(); by any values update, the axis will automatically update and seems range is not a proper choice.

import plotly.graph_objects as go
import random as rnd
import time
fig = go.FigureWidget();
fig.add_trace(go.Bar(x=[1, 2, 3], y=[1, 3, 2]));
display(fig)
fig.update_traces(y=[rnd.random()*10, rnd.random()*10, rnd.random()*10])
for i in range(100):
    fig.update_layout(scene = dict(xaxis = dict(range=[0,10],)))
    fig.update_traces(y=[rnd.random()*10, rnd.random()*10, rnd.random()*10],x=[rnd.random()*10, rnd.random()*10, rnd.random()*10])
    time.sleep(0.005)

Hi,

Have you tried this instead?

fig.update_layout(xaxis = dict(range=[0,10],))

Dear @jlfsjunior

Again you guide me with your great comment. Thanks

For the others that may visit this post and have same problem, The problem solved in this way:

import plotly.graph_objects as go
import random as rnd
import time
fig = go.FigureWidget();
fig.add_trace(go.Bar(x=[1, 2, 3], y=[1, 3, 2]));
display(fig)
fig.update_traces(y=[rnd.random()*10, rnd.random()*10, rnd.random()*10])
fig.update_layout(xaxis = dict(range=[0,10],))
for i in range(100):
    fig.update_traces(y=[rnd.random()*10, rnd.random()*10, rnd.random()*10],x=[rnd.random()*10, rnd.random()*10, rnd.random()*10])
    time.sleep(0.005)