Private
Public Access
1
0

fixed bug with disappearing div

This commit is contained in:
Sander Roosendaal
2018-10-23 21:33:23 +02:00
parent db078bec8b
commit 0c225126d2
3 changed files with 13 additions and 8 deletions

View File

@@ -319,7 +319,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type'):
p.legend.location = "top_left"
p.legend.background_fill_alpha = 0.7
# p.sizing_mode = 'scale_width'
#p.sizing_mode = 'scale_width'
p.sizing_mode = 'stretch_both'
p.yaxis.axis_label = 'Minutes'
@@ -3733,11 +3733,12 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
'power','hr','spm',
'time','pace','workoutstate',
'workoutid']
datadf = dataprep.getsmallrowdata_db(columns,ids=ids)
datadf.dropna(axis=1,how='all',inplace=True)
datadf.dropna(axis=0,how='any',inplace=True)
nrworkouts = len(ids)
try:
@@ -3800,13 +3801,14 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
tools=TOOLS,
toolbar_location="above",
plot_width=920,
plot_width=920,plot_height=500,
toolbar_sticky=False)
# add watermark
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'stretch_both'
plot.sizing_mode = 'scale_width'
plot.image_url([watermarkurl],0.05,0.9,
watermarkw,watermarkh,
@@ -3826,6 +3828,8 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
for id,color in itertools.izip(ids,colors):
group = datadf[datadf['workoutid']==int(id)].copy()
group.sort_values(by='time',ascending=True,inplace=True)
try:
group['x'] = group[xparam]
@@ -3837,6 +3841,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
except KeyError:
group['y'] = 0.0*group['x']
ymean = group['y'].mean()
ylabel = Label(x=100,y=60+nrworkouts*20-20*cntr,
x_units='screen',y_units='screen',
@@ -3909,8 +3914,6 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
script, div = components(plot)
return [script,div,message,errormessage]

View File

@@ -14,12 +14,14 @@
{{ interactiveplot |safe }}
<h1>Interactive Comparison</h1>
<ul class="main-content">
<li class="grid_4">
<div>
{{ the_div|safe }}
</div>
</li>
<li class="grid_4">
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">

View File

@@ -5376,7 +5376,7 @@ def multi_compare_view(request):
labeldict = {
int(w.id): w.__unicode__() for w in workouts
}
res = interactive_multiple_compare_chart(ids,xparam,yparam,
promember=promember,
plottype=plottype,