From Painless Streaming Plots with Bokeh it shows how to stream live data of a single variable. How do you stream multiple lines where there is more than one y variable.
import time
from bokeh.objects import GlyphRenderer
renderer = [r for r in curplot().renderers if isinstance(r, GlyphRenderer)][0]
ds = renderer.data_source
while True:
df = pd.io.json.read_json(url+json_call)
ds.data["x"] = x+N*i
ds.data["y"] = df.rssi
ds._dirty = True
session().store_obj(ds)
time.sleep(1.5)
i+=1
You can update many ds.data[]
items before calling session().store_objs(ds)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With