def make_fig(self, plot_source):
plot_specs = plot_source['plot_specs']
p = figure(plot_height=400, tools=TOOLS, y_axis_location='left', title=plot_specs.name)
p.xaxis.axis_label = plot_specs.x_axis_label
p.yaxis.axis_label = plot_specs.y_axis_label
p.x_range.follow = "end"
p.x_range.follow_interval = 10
p.x_range.range_padding = 0
# p.xaxis.formatter=DatetimeTickFormatter(dict(seconds=["%S"],minutes=["%M"],hours=["%d %B %Y"],days=["%d %B %Y"],months=["%d %B %Y"],years=["%d %B %Y"]))
p.xaxis.major_label_orientation = pi/4
p.line(x=plot_specs.x_axis_label, y=plot_specs.y_axis_label, color="blue", source=plot_specs.source)
p.circle(x=plot_specs.x_axis_label, y=plot_specs.y_axis_label, color="red", source=plot_specs.source)
curdoc().add_periodic_callback(functools.partial(self.update, name=plot_specs.name), plot_specs.update_period) #period in ms
return p
评论列表
文章目录