some prototypes

This commit is contained in:
2021-05-19 14:31:09 +02:00
parent 00ff746c74
commit 62e8cea4d6
5 changed files with 282 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python
from time import sleep
from random import random
from bokeh.plotting import curdoc, figure
from bokeh.models import ColumnDataSource
data = {
"x": [0, 1, 2, 3, 4],
"y": [6, 7, 2, 3, 5]
}
i = len(data["x"])
source = ColumnDataSource(data=data)
p = figure()
p.line(x="x", y="y", source=source)
def update():
global i
i += 1
new = {
"x": [i],
"y": [random()*10]
}
source.stream(new, rollover=50)
doc = curdoc()
doc.add_periodic_callback(update, 500)
doc.add_root(p)