I have multiple timeseries line plots that I update on an fixed interval (200ms periodic callback, using stream() api).
All figures share the same x-axis:
# create shared x_range and display the past 20 seconds
x_range = DataRange1d()
x_range.follow = "end"
x_range.follow_interval = 1000 * 20 # 20 seconds
x_range.range_padding_units = "percent"
x_range.range_padding = 0.01 # 1% padding
figure1 = figure(width=950, height=600,syncable=False, x_axis_type='datetime', y_axis_location = "right")
if x_range is not None:
figure1.x_range = x_range
# repeated for each plot
The goal is to display the data of the past 20 seconds. The issue is that the x-axis drifts over time as you can see in the following image:
Streaming looks like this:
data = {"x": [datetime.datetime.now()], "tilt": [alpha]}
source.stream(data, rollover=roll_over_amount)
All plots have different rollover
and the frequency of new data varies.
How can I prevent the x-axis drift?
Update: If I set the rollover to 2 then there is no drifting. Rollover in my code varies between 100 and 200 and update frequency is between 1Hz and 10Hz. (-> Frequency is dynamic and not in my control so I cant calculate a rollover window that fits 20 seconds of data for all plots)