带有散景

时间:2016-10-07 09:51:23

标签: python time-series bokeh live-streaming

我有一个数据文件,每5分钟更新一次新数据。我用pandas(index =日期和时间,然后是两列数据)导入这些数据,然后在时间序列中绘制它。每次向文件添加更多数据时,我都需要一种方法让html上的图表自动刷新和更新。如果能够在柱长变长的情况下做到这一点,那将是最好的,但每5分钟也会很好。

rubble = pd.read_csv('/TURB1.dat', usecols=['TIMESTAMP','TSS_shallow_corr_Med', 'TSS_deep_corr_Med',], skiprows=[2,3], na_values=['-'], index_col=0, parse_dates=True, header=1)

inshore = pd.read_csv('/TURB1_App.dat', usecols=['TIMESTAMP', 'TSS_shallow_corr_Med', 'TSS_deep_corr_Med',], skiprows=[2,3], na_values=['-'], index_col=0, parse_dates=True, header=1)

output_file("layout.html", title='Subtech Turbidity Data')
TOOLS="hover,crosshair,pan,wheel_zoom,box_zoom,reset,tap,save,box_select,poly_select,lasso_select"

创建图

rubble_day = TimeSeries(rubble, ylabel='mg/l', xlabel='TIME', width=750, height=500, title='Rubble Buoy', legend=True, tools=TOOLS)

inshore_day = TimeSeries(inshore[-1440:], ylabel='mg/l', xlabel='TIME', width=750, height=500, title='Inshore Buoy', legend=True, tools=TOOLS)

rubble_hour = TimeSeries(rubble[-60:], ylabel='mg/l', xlabel='TIME', width=500, height=500, title='Rubble Buoy', legend=True, tools=TOOLS)

inshore_hour = TimeSeries(inshore[-60:], ylabel='mg/l', xlabel='TIME', width=500, height=500, title='Inshore Buoy', legend=True, tools=TOOLS)

p = gridplot([[rubble_day, rubble_hour], [inshore_day, inshore_hour]])

show(p)

任何帮助都会非常感激!!!!

0 个答案:

没有答案