Streaming live data with bokeh and flask

Hi ,
I am trying to build a simple web application for visualising streaming data with flask and bokeh. I thought I would have found more documentation on this, but it is quite scarse. I hope to find some help here.

The basic code structure for my app can be found here on my github account:

Very simple, just a flask main and a HTML page, serving a bokeh figure.

I am using “bokeh.embed.components” to create the div and render the plot in the html page, I assume that at this point, in order to have the live update I need to have a javascript callback, something like js_on_change(‘stream’, callback) . How would I update my line in the javascript? is this the right way? when the callback is actually invoked? is “stream” in js_on_change the right option?

I have a flask entry point which return me a json with the new data point, how do I append to the chart?

Thank you.

Hello Dario,

You can take a look at flask_bokeh_ajax. You will find there several examples on how to embed dynamic bokeh plots including streaming without bokeh server.

Best,

Vitali

···

On Friday, March 31, 2017 at 11:39:36 AM UTC-4, Dario Cognome wrote:

Hi ,
I am trying to build a simple web application for visualising streaming data with flask and bokeh. I thought I would have found more documentation on this, but it is quite scarse. I hope to find some help here.

The basic code structure for my app can be found here on my github account:

https://github.com/DarioBernardo/Simple_streaming_bokeh

Very simple, just a flask main and a HTML page, serving a bokeh figure.

I am using “bokeh.embed.components” to create the div and render the plot in the html page, I assume that at this point, in order to have the live update I need to have a javascript callback, something like js_on_change(‘stream’, callback) . How would I update my line in the javascript? is this the right way? when the callback is actually invoked? is “stream” in js_on_change the right option?

I have a flask entry point which return me a json with the new data point, how do I append to the chart?

Thank you.