Create a fixed-window plot

As of Rerun 0.16, the TimeSeriesView now supports direct manipulation of visible time range. This allows you to create a plot that only shows a fixed window of data.

VisibleTimeRange

To specify the visible time range, you must pass a VisibleTimeRange object to the time_ranges parameter of the TimeSeriesView blueprint type.

The VisibleTimeRange object takes three parameters:

  • timeline: The timeline to use for the time range. This must match the timeline used to log your data.
  • start: The start of the visible time range.
  • end: The end of the visible time range.

The start and end parameters are set using a TimeRangeBoundary. This object can be used to specify a boundary, either as an absolute time or as a cursor-relative time.

  • To specify an absolute time, you can use the TimeRangeBoundary.absolute() method.
  • To specify a cursor-relative time, you can use the TimeRangeBoundary.cursor_relative() method.
  • You can also specify TimeRangeBoundary.infinite() to indicate that the start or end of the time range should be unbounded.

In order to account for the different types of timeline (temporal or sequence-based), both the TimeRangeBoundary.absolute() and TimeRangeBoundary.cursor_relative() methods can be specified using one of the keyword args:

  • seconds: Use this if you called rr.set_time_seconds() to update the timeline.
  • nanos: Use this if you called rr.set_time_nanos() to update the timeline.
  • seq: Use this if you called rr.set_time_seq() to update the timeline.

Example syntax

To create a trailing 5 second window plot, you can specify your TimeSeriesView like this:

rrb.TimeSeriesView( origin="plot_path", time_ranges=rrb.VisibleTimeRange( timeline="time", start=rrb.TimeRangeBoundary.cursor_relative(seconds=-5.0), end=rrb.TimeRangeBoundary.cursor_relative(), ) )

Full example

For a complete working example, you can run the following code:

This should create a plot that only shows the last 5 seconds of data. If you select the view, you should see that the time range is configured as expected.

Alternatively, you can check out a more full-featured example with multiple plot windows here.