def run(self):
print("In thread.run")
self.p = figure(plot_height=500, tools=TOOLS, y_axis_location='left', title=self.title)
self.p.x_range.follow = "end"
self.p.xaxis.axis_label = "Timestamp"
self.p.x_range.follow_interval = 100
self.p.x_range.range_padding = 0
self.p.line(x="timestamp", y="value", color="blue", source=self.source)
self.p.circle(x="timestamp", y="value", color="red", source=self.source)
self.session = push_session(curdoc())
curdoc().add_periodic_callback(self.update, 100) #period in ms
self.session.show(column(self.p))
curdoc().title = 'Sensor'
self.session.loop_until_closed()
# def register(self, d, sourceq):
# source = ColumnDataSource(dict(d))
# self.p.line(x=d[0], y=d[1], color="orange", source=source)
# curdoc().add_periodic_callback(self.update, 100) #period in ms
评论列表
文章目录