简体   繁体   English

散景更新多行

[英]Bokeh updating multiple lines

From Painless Streaming Plots with Bokeh it shows how to stream live data of a single variable. 具有Bokeh的无痛流图中,它展示了如何流化单个变量的实时数据。 How do you stream multiple lines where there is more than one y variable. 如何在有多个y变量的地方流多行。

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

您可以在调用session().store_objs(ds)之前更新许多ds.data[]项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM