graying out the intervals
This commit is contained in:
@@ -2114,7 +2114,7 @@ def interactive_streamchart(id=0,promember=0):
|
||||
|
||||
return [script,div]
|
||||
|
||||
def interactive_chart(id=0,promember=0):
|
||||
def interactive_chart(id=0,promember=0,intervaldata = {}):
|
||||
# Add hover to this comma-separated string and see what changes
|
||||
if (promember==1):
|
||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||
@@ -2219,6 +2219,24 @@ def interactive_chart(id=0,promember=0):
|
||||
plot.add_layout(LinearAxis(y_range_name="spmax",axis_label="SPM"),'right')
|
||||
|
||||
plot.legend.location = "bottom_right"
|
||||
|
||||
# add shaded bar chart areas
|
||||
intervaldf = pd.DataFrame(intervaldata)
|
||||
intervaldf['itime'] = intervaldf['itime']*1.e3
|
||||
intervaldf['time'] = intervaldf['itime'].cumsum()
|
||||
intervaldf['time_r'] = intervaldf['time'] +intervaldf['itime'].shift(-1)
|
||||
intervaldf['value'] = 45
|
||||
mask = intervaldf['itype'] == 3
|
||||
intervaldf.loc[mask,'value'] = 10
|
||||
intervaldf['bottom'] = 10
|
||||
|
||||
intervalsource = ColumnDataSource(
|
||||
intervaldf
|
||||
)
|
||||
|
||||
plot.quad(left='time',top='value',bottom='bottom',
|
||||
right='time_r',source=intervalsource,color='gray',
|
||||
y_range_name='spmax',fill_alpha=0.2,line_alpha=0.2)
|
||||
|
||||
script, div = components(plot)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user