individual curves
This commit is contained in:
@@ -151,6 +151,8 @@ class InstantPlanSelectForm(forms.Form):
|
|||||||
# Instroke Metrics interactive chart form
|
# Instroke Metrics interactive chart form
|
||||||
class InstrokeForm(forms.Form):
|
class InstrokeForm(forms.Form):
|
||||||
metric = forms.ChoiceField(label='metric',choices=(('a','a'),('b','b')))
|
metric = forms.ChoiceField(label='metric',choices=(('a','a'),('b','b')))
|
||||||
|
individual_curves = forms.BooleanField(label='individual curves',initial=False,
|
||||||
|
required=False)
|
||||||
spm_min = forms.IntegerField(initial=15,label='SPM Min',widget=HiddenInput)
|
spm_min = forms.IntegerField(initial=15,label='SPM Min',widget=HiddenInput)
|
||||||
spm_max = forms.IntegerField(initial=45,label='SPM Max',widget=HiddenInput)
|
spm_max = forms.IntegerField(initial=45,label='SPM Max',widget=HiddenInput)
|
||||||
activeminutesmin = forms.IntegerField(
|
activeminutesmin = forms.IntegerField(
|
||||||
|
|||||||
@@ -4071,7 +4071,10 @@ def interactive_streamchart(id=0, promember=0):
|
|||||||
return [script, div]
|
return [script, div]
|
||||||
|
|
||||||
def instroke_interactive_chart(df,metric, workout, spm_min, spm_max,
|
def instroke_interactive_chart(df,metric, workout, spm_min, spm_max,
|
||||||
activeminutesmin, activeminutesmax):
|
activeminutesmin, activeminutesmax,
|
||||||
|
individual_curves):
|
||||||
|
|
||||||
|
|
||||||
df_pos = (df+abs(df))/2.
|
df_pos = (df+abs(df))/2.
|
||||||
df_min = -(-df+abs(-df))/2.
|
df_min = -(-df+abs(-df))/2.
|
||||||
|
|
||||||
@@ -4173,11 +4176,20 @@ def instroke_interactive_chart(df,metric, workout, spm_min, spm_max,
|
|||||||
plot.add_layout(label)
|
plot.add_layout(label)
|
||||||
plot.add_layout(label2)
|
plot.add_layout(label2)
|
||||||
|
|
||||||
plot.varea('x', y1='high', y2='low',source=source,fill_color="lightgray",alpha=0.5)
|
if individual_curves:
|
||||||
|
for index,row in df.iterrows():
|
||||||
|
plot.line(xvals,row,color='lightgray',line_width=1)
|
||||||
|
else:
|
||||||
|
plot.varea('x', y1='high', y2='low',source=source,fill_color="lightgray",alpha=0.5)
|
||||||
|
|
||||||
plot.line('x','median',source=source,legend_label='median',color="black",
|
plot.line('x','median',source=source,legend_label='median',color="black",
|
||||||
line_width=3)
|
line_width=3)
|
||||||
|
|
||||||
|
medrange = mean_vals.max()-mean_vals.min()
|
||||||
|
yrange = Range1d(start=mean_vals.min()-0.2*medrange,
|
||||||
|
end=mean_vals.max()+0.2*medrange,)
|
||||||
|
plot.y_range = yrange
|
||||||
|
|
||||||
plot.add_tools(HoverTool(tooltips=TIPS))
|
plot.add_tools(HoverTool(tooltips=TIPS))
|
||||||
|
|
||||||
script, div = components(plot)
|
script, div = components(plot)
|
||||||
|
|||||||
@@ -2937,6 +2937,7 @@ def instroke_chart_interactive(request, id=0):
|
|||||||
activeminutesmax = int(rowdata.duration/60.)
|
activeminutesmax = int(rowdata.duration/60.)
|
||||||
activeminutesmin = 0
|
activeminutesmin = 0
|
||||||
maxminutes = activeminutesmax
|
maxminutes = activeminutesmax
|
||||||
|
individual_curves = False
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = InstrokeForm(request.POST,choices=instrokemetrics)
|
form = InstrokeForm(request.POST,choices=instrokemetrics)
|
||||||
@@ -2946,6 +2947,7 @@ def instroke_chart_interactive(request, id=0):
|
|||||||
spm_max = form.cleaned_data['spm_max']
|
spm_max = form.cleaned_data['spm_max']
|
||||||
activeminutesmin = form.cleaned_data['activeminutesmin']
|
activeminutesmin = form.cleaned_data['activeminutesmin']
|
||||||
activeminutesmax = form.cleaned_data['activeminutesmax']
|
activeminutesmax = form.cleaned_data['activeminutesmax']
|
||||||
|
individual_curves = form.cleaned_data['individual_curves']
|
||||||
|
|
||||||
|
|
||||||
activesecondsmin = 60.*activeminutesmin
|
activesecondsmin = 60.*activeminutesmin
|
||||||
@@ -2965,6 +2967,7 @@ def instroke_chart_interactive(request, id=0):
|
|||||||
spm_max,
|
spm_max,
|
||||||
activeminutesmin,
|
activeminutesmin,
|
||||||
activeminutesmax,
|
activeminutesmax,
|
||||||
|
individual_curves,
|
||||||
)
|
)
|
||||||
|
|
||||||
# change to range spm_min to spm_max
|
# change to range spm_min to spm_max
|
||||||
|
|||||||
Reference in New Issue
Block a user