Question

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
Was it helpful?

Solution

You can update many ds.data[] items before calling session().store_objs(ds).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top