✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Keep Streaming Window Fixed Right

This has likely been covered before but I just cannot seem to come up with the right combination of search terms to find what I am looking for.

I am streaming a time based single line plot, it updates every second using Plotly.extendTraces();
I am also using the rangeslider and rangeselectors.
I have say 1 min and 5 min rangeselectors, when I select one it adjusts the the most recent 5 minutes and new streaming data is added outside of the current viewing window, to the right of the current data I am viewing.
I am looking for a way to select a 1 min rangeselector and have it always maintain the most recent 1 minute or most recent 5 minutes.

Adding Plotly.relayout(gd, 'xaxis.range', [/* your new range */]) after your extendTraces call should do the trick.

2 Likes