Private
Public Access
1
0

adding slider annotation to trend flex

This commit is contained in:
Sander Roosendaal
2019-03-31 17:02:14 +02:00
parent b654a1f1a9
commit b97990b905
2 changed files with 23 additions and 8 deletions

View File

@@ -2370,7 +2370,8 @@ def interactive_chart(id=0,promember=0,intervaldata = {}):
def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
ploterrorbars=False,
title=None,binsize=1,colorlegend=[]):
title=None,binsize=1,colorlegend=[],
spmmin=0,spmmax=0,workmin=0,workmax=0):
if datadf.empty:
return ['','<p>No non-zero data in selection</p>']
@@ -2515,8 +2516,8 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
for nr, gvalue, color in colorlegend:
box = BoxAnnotation(bottom=125+20*nr,left=100,top=145+20*nr,
right=120,
box = BoxAnnotation(bottom=75+20*nr,left=50,top=95+20*nr,
right=70,
bottom_units='screen',
top_units='screen',
left_units='screen',
@@ -2524,7 +2525,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
fill_color=color,
fill_alpha=1.0,
line_color=color)
legendlabel = Label(x=121,y=128+20*nr,x_units='screen',
legendlabel = Label(x=71,y=78+20*nr,x_units='screen',
y_units='screen',
text = "{gvalue:3.0f}".format(gvalue=gvalue),
background_fill_alpha=1.0,
@@ -2534,7 +2535,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
plot.add_layout(legendlabel)
if colorlegend:
legendlabel = Label(x=372,y=300,x_units='screen',
legendlabel = Label(x=322,y=250,x_units='screen',
y_units='screen',
text = 'group legend',
text_color='black',
@@ -2552,15 +2553,27 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
else:
plot.yaxis.axis_label = axlabels[yparam]
binlabel = Label(x=100,y=100,x_units='screen',
binlabel = Label(x=50,y=50,x_units='screen',
y_units='screen',
text="Bin size {binsize:3.1f}".format(binsize=binsize),
background_fill_alpha=0.7,
background_fill_color='white',
text_color='black',
text_color='black',text_font_size='10pt',
)
slidertext = 'SPM: {:.0f}-{:.0f}, WpS: {:.0f}-{:.0f}'.format(
spmmin,spmmax,workmin,workmax
)
sliderlabel = Label(x=50,y=20,x_units='screen',y_units='screen',
text=slidertext,
background_fill_alpha=0.7,
background_fill_color='white',
text_color='black',text_font_size='10pt',
)
plot.add_layout(binlabel)
plot.add_layout(sliderlabel)
yrange1 = Range1d(start=yaxmin,end=yaxmax)
plot.y_range = yrange1

View File

@@ -2593,7 +2593,9 @@ def multiflex_data(request,userid=0,
extratitle=extratitle,
ploterrorbars=ploterrorbars,
binsize=binsize,
colorlegend=colorlegend)
colorlegend=colorlegend,
spmmin=spmmin,spmmax=spmmax,
workmin=workmin,workmax=workmax)
scripta= script.split('\n')[2:-1]
script = ''.join(scripta)