# How to update rangeslider when extendTrace api using?

**URL:** <https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713>\
**Category:** plotly.js\
**Created:** [August 2, 2016, 8:13am UTC](https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713 "2016-08-02T08:13:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenny](https://avatars.discourse-cdn.com/v4/letter/k/90db22/32.png) [@Kenny](https://community.plotly.com/u/Kenny)\
**Post date:** [August 2, 2016, 8:13am UTC](https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713/1 "2016-08-02T08:13:36Z")

</div>

Hi,

How can I make the rangeSlider shows all in real-time charting?  
it shows only one dot in my example.

that is what I’m trying:  
https://codepen.io/smileyeoni/embed/preview/BzOQpr?height=300&slug-hash=BzOQpr&default-tabs=js,result&host=https://codepen.io&embed-version=2

Thank you.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 2, 2016, 1:59pm UTC](https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713/2 "2016-08-02T13:59:08Z")

</div>

Thanks for the report.

There are a few bugs in our range slider at the moment that will we fix in the next few weeks.

I’d recommend subscribing to [https://github.com/plotly/plotly.js/issues/686](https://github.com/plotly/plotly.js/issues/686) for the latest development info.

---

<div class="post-metadata">

**Author:** ![Kenny](https://avatars.discourse-cdn.com/v4/letter/k/90db22/32.png) [@Kenny](https://community.plotly.com/u/Kenny)\
**Post date:** [August 3, 2016, 1:53am UTC](https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713/3 "2016-08-03T01:53:21Z")

</div>

Thank you for your reply Etienne.  
Ok I will. Thank you again.

---

<div class="post-metadata">

**Author:** ![PeterC](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@PeterC](https://community.plotly.com/u/PeterC)\
**Post date:** [August 16, 2020, 10:00am UTC](https://community.plotly.com/t/how-to-update-rangeslider-when-extendtrace-api-using/1713/4 "2020-08-16T10:00:12Z")

</div>

Hey @etienne,  
I know this is resolved but I am facing a very similar issue.

I am using [https://dash.plotly.com/dash-core-components/graph](https://dash.plotly.com/dash-core-components/graph) `extendData` to update a graph with on relayout.  
Unfortunately, the rangeslider will always be empty even though the chart updates properly.

 ![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/7/79bd8e3a154b6db5e24b15e3a45b14f0ca87b860.png)

```auto
df = pd.DataFrame({"x": x, "y": y})
df["x"] = pd.to_datetime(df["x"])

def figure():
    data = df.iloc[initial_start_x:initial_end_x]
    fig = go.Figure(data=go.Scattergl(x=[], y=[], mode="lines"))
    fig.update_layout(clickmode="event")
    fig.update_yaxes(fixedrange=True)
    fig.update_layout(xaxis=dict(rangeslider=dict(visible=True)))
    return fig

app.layout = html.Div(
    children=[
        dcc.Store(id="store"),
        dcc.Graph(
            id="graph", figure=figure(), animate=True, config=dict(scrollZoom=True)
        ),
    ]
)

@app.callback(
    [Output("graph", "extendData"), Output("store", "data")],
    [Input("graph", "relayoutData")],
    [State("store", "data")]
)
def relayout_figure(relayoutData, store):
    fig_data = dash.no_update
    store_data = dash.no_update

    if not store:
        initial_fig_data = df.iloc[initial_start_x:initial_end_x]
        x = initial_fig_data["x"]
        y = initial_fig_data["y"]

        fig_data = dict(x=[x], y=[y])
        store_data = {"x": max(x)}
    elif (
        relayoutData
        and "xaxis.range[0]" in relayoutData
        and "xaxis.range[1]" in relayoutData
    ):
        x_start = relayoutData["xaxis.range[0]"]
        x_end = relayoutData["xaxis.range[1]"]
        print(f"{x_start} - {x_end}")
        new_fig_data = get_data_in_timeframe(x_start, x_end)

        last_x = store["x"]

        x = new_fig_data["x"]
        y = new_fig_data["y"]

        # deduplicate
        mask = x > last_x
        x = x[mask]
        y = y[mask]

        fig_data = dict(x=[x], y=[y])

        if not x.empty:
            store_data = {"x": max(x)}

    return fig_data, store_data

```

Thank you.
