1
を使用して線グラフをプロットすることはできません。..私はこのコードを実行するには、出力の任意の並べ替え(空欄)を取得することはできませんよボケストリーミング
from bokeh.io import gridplot,vplot,hplot
from bokeh.models import ColumnDataSource, Slider, Select
from bokeh.plotting import curdoc, figure
source = ColumnDataSource(dict(time=[],virt=[]))
def update():
with open('test.log', 'r') as f:
f.seek(0, 2)
cur = f.tell()
f.seek((cur - 198))
s = f.read(198)
arr = s.replace('\n','').replace('[','').replace(']','').split(' ')
new_data = dict(time=[arr[0]+" "+arr[1]], virt=[arr[11]])
print(new_data) # sample output {'virt': ['2912m'], 'time':['2016-06-28 13:09:57']}
source.stream(new_data)
p2 = figure(tools="xpan,xwheel_zoom,xbox_zoom,reset", x_axis_type='datetime', y_axis_location="right")
p2.x_range.follow = "end"
p2.x_range.follow_interval = 100
p2.x_range.range_padding = 5
p2.line(x='time', y='virt', alpha=0.8, line_width=2, color='black', source=source)
curdoc().add_root(gridplot([[p2]],toolbar_location="left"))
curdoc().add_periodic_callback(update, 1000)
curdoc().title = "Server Logs"
私が間違っているつもりですどこにとして私を助けてください?