Callback on finished rendering?

Is there an event I can use to detect when the browser finished rendering an update of ColumnDataSource?

on_change(“data”) seems to trigger when the data is sent to the browser, but not being processed yet.

I’d like to get a feedback from the browser to confirm that the data has been received AND processed. Currently, I seem to update my plots faster than the browser is able to process which leads to several seconds of delay even after I stop sending new data.

In recent versions of Bokeh there is a “document ready” event at startup, but there’s not currently any subsequent “finished rendering” event for plots. Plots can have deferred elements (e.g. images that load from external URLs or math text) so not everyone may agree on a definition of “done”. Also lots of things besides CDS changes can cause a plot to re-render. If you need this level of control then Bokeh might not be the best tool for your use-case.

There is a mechanism for determining when bokehjs finished computing after a change of some sort, i.e. View.ready promise, but that’s currently buried deeply in bokehjs’ internals. We use this extensively in bokehjs’ tests. I would suggest starting an feature request issue for this. We may be able to provide a user facing API for this.

Just adding the helpful link: GitHub Issue

Thanks! I just added the request. As written there, what helps at least a bit is to use hold(render=True). This doesn’t solve the initial issue but speeds things up a bit.

1 Like