Time series dynamic downsampling help

Hi! I am quite new to bokeh, and I am trying to implement what has been referred to as “server side downsampling” or “dynamic downsampling”.

I now have a website that displays many static images of time series, but I would (of course) like to make them all interactive. I am using flask.

I previously used mpld3, but as data points have increased, this library has proved itself unsuitable.
I have seen a demo of an interactive plot in bokeh handle time series data with up to 2 million data points with impressive performance, and so now I would like to replicate this.

So over to my questions:

  1. How do you make server side downsampling work for a time series data? (disregarding flask, using bokeh-server’s own visualizations in this step should be enough)
  2. How do I then pair this with my flask app?
    Really, I have mostly been struggling with point 1, and I think I integration with flask should not be too much of a hazzle.
    If anyone could show me a minimum working code example, or point me toward the places where this is described, or any helpful direction, this would be super helpful.

I am very excited about using bokeh for my project, so thank you very much for helping me get started!