Private
Public Access
1
0

graying out the intervals

This commit is contained in:
Sander Roosendaal
2018-06-19 22:17:36 +02:00
parent 12bb31553b
commit d7b7b0b6d4
2 changed files with 44 additions and 9 deletions

View File

@@ -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)