Merge branch 'feature/intervals' into develop
This commit is contained in:
@@ -2114,7 +2114,7 @@ def interactive_streamchart(id=0,promember=0):
|
|||||||
|
|
||||||
return [script,div]
|
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
|
# Add hover to this comma-separated string and see what changes
|
||||||
if (promember==1):
|
if (promember==1):
|
||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||||
@@ -2220,6 +2220,24 @@ def interactive_chart(id=0,promember=0):
|
|||||||
|
|
||||||
plot.legend.location = "bottom_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'] = 10
|
||||||
|
mask = intervaldf['itype'] == 3
|
||||||
|
intervaldf.loc[mask,'value'] = 45
|
||||||
|
intervaldf['bottom'] = 10
|
||||||
|
|
||||||
|
intervalsource = ColumnDataSource(
|
||||||
|
intervaldf
|
||||||
|
)
|
||||||
|
|
||||||
|
plot.quad(left='time',top='value',bottom='bottom',
|
||||||
|
right='time_r',source=intervalsource,color='pink',
|
||||||
|
y_range_name='spmax',fill_alpha=0.2,line_alpha=0.2)
|
||||||
|
|
||||||
script, div = components(plot)
|
script, div = components(plot)
|
||||||
|
|
||||||
return [script,div]
|
return [script,div]
|
||||||
|
|||||||
@@ -11286,13 +11286,6 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
return HttpResponse("Error: CSV Data File Not Found")
|
return HttpResponse("Error: CSV Data File Not Found")
|
||||||
nrintervals = len(idist)
|
nrintervals = len(idist)
|
||||||
|
|
||||||
# create interactive plot
|
|
||||||
try:
|
|
||||||
res = interactive_chart(id,promember=1)
|
|
||||||
script = res[0]
|
|
||||||
div = res[1]
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
savebutton = 'nosavebutton'
|
savebutton = 'nosavebutton'
|
||||||
formvalues = {}
|
formvalues = {}
|
||||||
@@ -11310,9 +11303,17 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
data = {
|
data = {
|
||||||
'power': int(normp),
|
'power': int(normp),
|
||||||
'pace': avpace,
|
'pace': avpace,
|
||||||
'selector': normp,
|
'selector': 'power',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
powerorpace = 'power'
|
||||||
|
|
||||||
|
if normp == 0:
|
||||||
|
data['selector'] = 'pace'
|
||||||
|
powerorpace = 'pace'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
powerupdateform = PowerIntervalUpdateForm(initial=data)
|
powerupdateform = PowerIntervalUpdateForm(initial=data)
|
||||||
|
|
||||||
# We have submitted the mini language interpreter
|
# We have submitted the mini language interpreter
|
||||||
@@ -11568,6 +11569,22 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
|
|
||||||
detailform = IntervalUpdateForm(aantal=nrintervals,initial=initial)
|
detailform = IntervalUpdateForm(aantal=nrintervals,initial=initial)
|
||||||
|
|
||||||
|
# create interactive plot
|
||||||
|
try:
|
||||||
|
intervaldata = {
|
||||||
|
'itime':itime,
|
||||||
|
'idist':idist,
|
||||||
|
'itype':itype,
|
||||||
|
'selector': powerorpace,
|
||||||
|
'normp': normp,
|
||||||
|
'normv': normv,
|
||||||
|
}
|
||||||
|
res = interactive_chart(id,promember=1,intervaldata=intervaldata)
|
||||||
|
script = res[0]
|
||||||
|
div = res[1]
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
# render page
|
# render page
|
||||||
|
|
||||||
return render(request, 'summary_edit.html',
|
return render(request, 'summary_edit.html',
|
||||||
|
|||||||
Reference in New Issue
Block a user