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)
|
||||
|
||||
|
||||
@@ -11286,13 +11286,6 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
return HttpResponse("Error: CSV Data File Not Found")
|
||||
nrintervals = len(idist)
|
||||
|
||||
# create interactive plot
|
||||
try:
|
||||
res = interactive_chart(id,promember=1)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
savebutton = 'nosavebutton'
|
||||
formvalues = {}
|
||||
@@ -11310,8 +11303,16 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
data = {
|
||||
'power': int(normp),
|
||||
'pace': avpace,
|
||||
'selector': normp,
|
||||
'selector': 'power',
|
||||
}
|
||||
|
||||
powerorpace = 'power'
|
||||
|
||||
if normp == 0:
|
||||
data['selector'] = 'pace'
|
||||
powerorpace = 'pace'
|
||||
|
||||
|
||||
|
||||
powerupdateform = PowerIntervalUpdateForm(initial=data)
|
||||
|
||||
@@ -11568,6 +11569,22 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
|
||||
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
|
||||
|
||||
return render(request, 'summary_edit.html',
|
||||
|
||||
Reference in New Issue
Block a user