Hi, I have implemented downsampling on server for large datasets. I tested with 800 000+ and 8 000 000 points, but should work for more if memory allows. It is not optimal - I started learning python,numpy and pandas last week and bokeh this week.
How it works: original dataset is a time series with 800 000 + points. Then downsampled versions of dataset are precomputed. Each downsampled version has 4 times lower sampling frequency than the one before. I use callback to detect start and end of x axis when user zooms and based on current zoom I load a version of dataset with appropriate sampling frequency to plot, such that there is always at maximum as many points as (width of plot in pixels) * 4.
I display the data not as line but as patch to be able to plot not mean but min and max. I think it is more informative than mean.
When replacing data there is a short glitch visible in the browser. Can this be avoided? E.g. repaint plot in a different way? Try the code and see for yourselves. Ideally I would first like to paint the desired new version of dataset, before removing the version of dataset that has unsatisfactiory samplig frequency. Is this possible?
I attach the code, it should be run as
bokeh serve --show demonstration_downsampling_2.py
demonstration_downsampling_2.py (6.23 KB)