holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.69k stars 402 forks source link

Improve following behavior when streaming #6318

Closed philippjfr closed 1 week ago

philippjfr commented 2 months ago

There still appears to be a race condition in bokeh where if a stream event arrives while the frontend is rendering it can cause "backtracking" glitches.

TODO:

Code ```python import asyncio import pandas as pd import numpy as np import holoviews as hv hv.extension('bokeh') nchannels = 25 buffer = hv.streams.Buffer(data=pd.DataFrame(np.random.randn(10, nchannels).cumsum(axis=1), columns=[chr(65+i) for i in range(nchannels)])) def out(data): return hv.NdOverlay( {chr(65+i): hv.Curve(data, 'index', (chr(65+i), 'Amplitude')).opts(subcoordinate_y=True) for i in range(nchannels)} ) dmap = hv.DynamicMap(out, streams=[buffer]).opts(legend_position='right', legend_cols=2, responsive=True, min_height=600) pane = pn.pane.HoloViews(dmap) async def stream(event): for i in range(1, 1000): buffer.event(data=pd.DataFrame(np.random.randn(10, nchannels).cumsum(axis=1), columns=[chr(65+i) for i in range(nchannels)], index=np.arange(i*10, i*10+10))) await asyncio.sleep(0.01) pn.Column(pn.widgets.Button(on_click=stream, name='Stream'), pane).servable() ```

ezgif-3-bde2bf8b98

philippjfr commented 1 month ago

The backtracking behavior was fixed in https://github.com/holoviz/panel/pull/7128

philippjfr commented 1 month ago

With range handling:

ezgif-6-90d086a92b

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 76.40449% with 21 lines in your changes missing coverage. Please review.

Project coverage is 88.48%. Comparing base (3b3f10f) to head (62a20ab). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/plotting/bokeh/element.py 65.71% 12 Missing :warning:
holoviews/plotting/bokeh/plot.py 0.00% 9 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6318 +/- ## ========================================== - Coverage 88.49% 88.48% -0.02% ========================================== Files 323 323 Lines 68304 68431 +127 ========================================== + Hits 60448 60550 +102 - Misses 7856 7881 +25 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.