Timeseries Streaming In Bokeh
Solution 1:
As of Bokeh 0.11.1
there is now a streaming interface to column data sources in Bokeh server apps. You can see and easily run an example here:
https://github.com/bokeh/bokeh/tree/master/examples/app/ohlc
That example shows a live updating OHLC chart with MACD indicator (based on synthetic tick data) that only updates the plot with the most recent data points on every update.
Basically, using the streaming interface consists of two parts. First create a new dict
with same "shape" as your column data source:
new_data = dict(
time=[t],
open=[open],
high=[high],
low=[low],
close=[close],
average=[average],
color=[color],
)
Then pass this to the .stream
method, with an optional rollover
argument that specifies how big of a buffer to keep in the browser (earlier data starts to get dropped off):
source.stream(new_data, 300)
Then, just the small amount of data in new_data
willbe sent to the plot, not everything.
Post a Comment for "Timeseries Streaming In Bokeh"