Update app data from script


I would like some ideas on how to deal with the following scenario: I have a python process that generates a bunch of data every once in a while and sends it to a Plotter object.

This object should publish on the server an histogram of the data every time some new data arrives. The plot on the server should be dynamic, meaning that it should show the evolution of the histogram through the iterations.

What I would like to achieve is something like the following:

  • an animation that continuously cycles through the histograms, showing the histogram at time 0, then the histogram at time 1, and so on. This should be an infinite loop, restarting from the first histogram once the last one has been reached.
  • an histogram and a slider. The slider should allow to select which histogram to show.
  • …whatever other solution that allows to see the evolution of the histograms through time :slight_smile:
    Ideally, the animation should not rely on an infinite loop that continuously updates the data on the server (such as in the animated line example), as the amount of data is significant and sending it continuously to the server would probably have very bad performances.

The perfect solution would be a script that pushes the new data to the server as it is generated (attaching it to the existing data on the server) and a script on the server that either continuously reads the data and updates the plot (solution 1) or updates the plot whenever new data arrives and lets the user choose which epoch to visualize (solution 2).

Is any of this doable with Bokeh?

Thank you for your help!