added flexall
This commit is contained in:
@@ -841,11 +841,39 @@ analysischoices = (
|
||||
('boxplot','Box Chart'),
|
||||
('trendflex','Trend Flex'),
|
||||
('histo','Histogram'),
|
||||
('flexall','Cumulative Flex Chart')
|
||||
)
|
||||
|
||||
|
||||
|
||||
class AnalysisChoiceForm(forms.Form):
|
||||
axchoices = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','None']
|
||||
)
|
||||
axchoices = dict((x,y) for x,y in axchoices)
|
||||
axchoices = list(sorted(axchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices = list((ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time'])
|
||||
yaxchoices = dict((x,y) for x,y in yaxchoices)
|
||||
yaxchoices = list(sorted(yaxchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices2 = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||
)
|
||||
yaxchoices2 = dict((x,y) for x,y in yaxchoices2)
|
||||
yaxchoices2 = list(sorted(yaxchoices2.items(), key = lambda x:x[1]))
|
||||
|
||||
function = forms.ChoiceField(choices=analysischoices,initial='boxplot',
|
||||
label='Analysis')
|
||||
xaxis = forms.ChoiceField(
|
||||
choices=axchoices,label='X-Axis',required=True,initial='spm')
|
||||
yaxis1 = forms.ChoiceField(
|
||||
choices=yaxchoices,label='Left Axis',required=True,initial='power')
|
||||
yaxis2 = forms.ChoiceField(
|
||||
choices=yaxchoices2,label='Right Axis',required=True,initial='None')
|
||||
|
||||
plotfield = forms.ChoiceField(choices=parchoices,initial='spm',
|
||||
label='Metric')
|
||||
xparam = forms.ChoiceField(choices=parchoicesmultiflex,
|
||||
@@ -854,6 +882,7 @@ class AnalysisChoiceForm(forms.Form):
|
||||
yparam = forms.ChoiceField(choices=parchoicesmultiflex,
|
||||
initial='pace',
|
||||
label='Y axis')
|
||||
|
||||
groupby = forms.ChoiceField(choices=groupchoices,initial='spm',
|
||||
label='Group By')
|
||||
binsize = forms.FloatField(initial=1,required=False,label = 'Bin Size')
|
||||
|
||||
@@ -72,11 +72,19 @@
|
||||
var plotfield = $("#id_plotfield").parent().parent();
|
||||
var x_param = $("#id_xparam").parent().parent();
|
||||
var y_param = $("#id_yparam").parent().parent();
|
||||
|
||||
var groupby = $("#id_groupby").parent().parent();
|
||||
var binsize = $("#id_binsize").parent().parent();
|
||||
var errorbars = $("#id_ploterrorbars").parent().parent();
|
||||
var palette = $("#id_palette").parent().parent();
|
||||
var spmmin = $("#id_spmmin").parent().parent();
|
||||
var spmmax = $("#id_spmmax").parent().parent();
|
||||
var workmin = $("#id_workmin").parent().parent();
|
||||
var workmax = $("#id_workmax").parent().parent();
|
||||
|
||||
var xaxis = $("#id_xaxis").parent().parent();
|
||||
var yaxis1 = $("#id_yaxis1").parent().parent();
|
||||
var yaxis2 = $("#id_yaxis2").parent().parent();
|
||||
|
||||
// Hide the fields.
|
||||
// Use JS to do this in case the user doesn't have JS
|
||||
@@ -88,6 +96,9 @@
|
||||
errorbars.hide();
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
xaxis.hide();
|
||||
yaxis1.hide();
|
||||
yaxis2.hide();
|
||||
|
||||
if (functionfield.val() == 'boxplot') {
|
||||
plotfield.show();
|
||||
@@ -95,7 +106,7 @@
|
||||
|
||||
if (functionfield.val() == 'histo') {
|
||||
plotfield.show()
|
||||
}
|
||||
};
|
||||
|
||||
if (functionfield.val() == 'trendflex') {
|
||||
x_param.show();
|
||||
@@ -106,6 +117,12 @@
|
||||
errorbars.show();
|
||||
};
|
||||
|
||||
if (functionfield.val() == 'flexall') {
|
||||
xaxis.show();
|
||||
yaxis1.show();
|
||||
yaxis2.show();
|
||||
}
|
||||
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
// checkbox changes.
|
||||
@@ -117,21 +134,36 @@
|
||||
if (Value=='boxplot') {
|
||||
// Show the hidden fields.
|
||||
plotfield.show();
|
||||
spmmin.show();
|
||||
spmmax.show();
|
||||
workmin.show();
|
||||
workmax.show();
|
||||
x_param.hide();
|
||||
y_param.hide();
|
||||
groupby.hide();
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
errorbars.hide();
|
||||
xaxis.hide();
|
||||
yaxis1.hide();
|
||||
yaxis2.hide();
|
||||
}
|
||||
else if (Value=='histo') {
|
||||
plotfield.show();
|
||||
spmmin.show();
|
||||
spmmax.show();
|
||||
workmin.show();
|
||||
workmax.show();
|
||||
x_param.hide();
|
||||
y_param.hide();
|
||||
groupby.hide();
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
errorbars.hide();
|
||||
xaxis.hide();
|
||||
yaxis1.hide();
|
||||
yaxis2.hide();
|
||||
|
||||
}
|
||||
else if (Value=='trendflex') {
|
||||
x_param.show();
|
||||
@@ -140,12 +172,35 @@
|
||||
palette.show();
|
||||
binsize.show();
|
||||
errorbars.show();
|
||||
spmmin.show();
|
||||
spmmax.show();
|
||||
workmin.show();
|
||||
workmax.show();
|
||||
plotfield.hide();
|
||||
xaxis.hide();
|
||||
yaxis1.hide();
|
||||
yaxis2.hide();
|
||||
|
||||
}
|
||||
else if (Value=='flexall') {
|
||||
xaxis.show();
|
||||
yaxis1.show();
|
||||
yaxis2.show();
|
||||
x_param.hide();
|
||||
y_param.hide();
|
||||
groupby.hide();
|
||||
spmmin.hide();
|
||||
spmmax.hide();
|
||||
workmin.hide();
|
||||
workmax.hide();
|
||||
plotfield.hide();
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
errorbars.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div id="id_css_res">
|
||||
|
||||
@@ -415,6 +415,29 @@ def trendflexdata(workouts, options,userid=0):
|
||||
|
||||
return(script,div)
|
||||
|
||||
def flexalldata(workouts, options):
|
||||
includereststrokes = options['includereststrokes']
|
||||
xparam = options['xaxis']
|
||||
yparam1 = options['yaxis1']
|
||||
yparam2 = options['yaxis2']
|
||||
promember=True
|
||||
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
res = interactive_cum_flex_chart2(workouts, xparam=xparam,
|
||||
yparam1=yparam1,
|
||||
yparam2=yparam2,
|
||||
promember=promember,
|
||||
workstrokesonly=workstrokesonly,
|
||||
)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
|
||||
scripta = script.split('\n')[2:-1]
|
||||
script = ''.join(scripta)
|
||||
|
||||
return(script,div)
|
||||
|
||||
def histodata(workouts, options):
|
||||
includereststrokes = options['includereststrokes']
|
||||
plotfield = options['plotfield']
|
||||
@@ -545,6 +568,8 @@ def analysis_view_data(request,userid=0):
|
||||
script, div = trendflexdata(workouts, options,userid=userid)
|
||||
elif function == 'histo':
|
||||
script, div = histodata(workouts, options)
|
||||
elif function == 'flexall':
|
||||
script,div = flexalldata(workouts,options)
|
||||
else:
|
||||
script = ''
|
||||
div = 'Unknown analysis functions'
|
||||
|
||||
Reference in New Issue
Block a user