added compare
This commit is contained in:
@@ -843,6 +843,7 @@ analysischoices = (
|
|||||||
('histo','Histogram'),
|
('histo','Histogram'),
|
||||||
('flexall','Cumulative Flex Chart'),
|
('flexall','Cumulative Flex Chart'),
|
||||||
('stats','Statistics'),
|
('stats','Statistics'),
|
||||||
|
('compare','Compare'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -859,7 +860,11 @@ class AnalysisChoiceForm(forms.Form):
|
|||||||
yaxchoices = dict((x,y) for x,y in yaxchoices)
|
yaxchoices = dict((x,y) for x,y in yaxchoices)
|
||||||
yaxchoices = list(sorted(yaxchoices.items(), key = lambda x:x[1]))
|
yaxchoices = list(sorted(yaxchoices.items(), key = lambda x:x[1]))
|
||||||
|
|
||||||
|
plotchoices = (
|
||||||
|
('line','Line Plot'),
|
||||||
|
('scatter','Scatter Plot'),
|
||||||
|
)
|
||||||
|
|
||||||
yaxchoices2 = list(
|
yaxchoices2 = list(
|
||||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||||
)
|
)
|
||||||
@@ -874,6 +879,7 @@ class AnalysisChoiceForm(forms.Form):
|
|||||||
choices=yaxchoices,label='Left Axis',required=True,initial='power')
|
choices=yaxchoices,label='Left Axis',required=True,initial='power')
|
||||||
yaxis2 = forms.ChoiceField(
|
yaxis2 = forms.ChoiceField(
|
||||||
choices=yaxchoices2,label='Right Axis',required=True,initial='None')
|
choices=yaxchoices2,label='Right Axis',required=True,initial='None')
|
||||||
|
plottype = forms.ChoiceField(choices=plotchoices,initial='scatter')
|
||||||
|
|
||||||
plotfield = forms.ChoiceField(choices=parchoices,initial='spm',
|
plotfield = forms.ChoiceField(choices=parchoices,initial='spm',
|
||||||
label='Metric')
|
label='Metric')
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
var xaxis = $("#id_xaxis").parent().parent();
|
var xaxis = $("#id_xaxis").parent().parent();
|
||||||
var yaxis1 = $("#id_yaxis1").parent().parent();
|
var yaxis1 = $("#id_yaxis1").parent().parent();
|
||||||
var yaxis2 = $("#id_yaxis2").parent().parent();
|
var yaxis2 = $("#id_yaxis2").parent().parent();
|
||||||
|
var plottype = $("#id_plottype").parent().parent();
|
||||||
|
|
||||||
// Hide the fields.
|
// Hide the fields.
|
||||||
// Use JS to do this in case the user doesn't have JS
|
// Use JS to do this in case the user doesn't have JS
|
||||||
@@ -99,6 +100,7 @@
|
|||||||
xaxis.hide();
|
xaxis.hide();
|
||||||
yaxis1.hide();
|
yaxis1.hide();
|
||||||
yaxis2.hide();
|
yaxis2.hide();
|
||||||
|
plottype.hide();
|
||||||
|
|
||||||
if (functionfield.val() == 'boxplot') {
|
if (functionfield.val() == 'boxplot') {
|
||||||
plotfield.show();
|
plotfield.show();
|
||||||
@@ -127,6 +129,12 @@
|
|||||||
plotfield.hide();
|
plotfield.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (functionfield.val() == 'compare') {
|
||||||
|
xaxis.show();
|
||||||
|
yaxis1.show();
|
||||||
|
plottype.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup an event listener for when the state of the
|
// Setup an event listener for when the state of the
|
||||||
// checkbox changes.
|
// checkbox changes.
|
||||||
@@ -151,6 +159,7 @@
|
|||||||
xaxis.hide();
|
xaxis.hide();
|
||||||
yaxis1.hide();
|
yaxis1.hide();
|
||||||
yaxis2.hide();
|
yaxis2.hide();
|
||||||
|
plottype.hide();
|
||||||
}
|
}
|
||||||
else if (Value=='histo') {
|
else if (Value=='histo') {
|
||||||
plotfield.show();
|
plotfield.show();
|
||||||
@@ -167,6 +176,7 @@
|
|||||||
xaxis.hide();
|
xaxis.hide();
|
||||||
yaxis1.hide();
|
yaxis1.hide();
|
||||||
yaxis2.hide();
|
yaxis2.hide();
|
||||||
|
plottype.hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Value=='trendflex') {
|
else if (Value=='trendflex') {
|
||||||
@@ -184,6 +194,7 @@
|
|||||||
xaxis.hide();
|
xaxis.hide();
|
||||||
yaxis1.hide();
|
yaxis1.hide();
|
||||||
yaxis2.hide();
|
yaxis2.hide();
|
||||||
|
plottype.hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Value=='flexall') {
|
else if (Value=='flexall') {
|
||||||
@@ -200,6 +211,7 @@
|
|||||||
plotfield.hide();
|
plotfield.hide();
|
||||||
palette.hide();
|
palette.hide();
|
||||||
binsize.hide();
|
binsize.hide();
|
||||||
|
plottype.hide();
|
||||||
errorbars.hide();
|
errorbars.hide();
|
||||||
}
|
}
|
||||||
else if (Value=='stats') {
|
else if (Value=='stats') {
|
||||||
@@ -213,6 +225,24 @@
|
|||||||
palette.hide();
|
palette.hide();
|
||||||
binsize.hide();
|
binsize.hide();
|
||||||
errorbars.hide();
|
errorbars.hide();
|
||||||
|
plottype.hide();
|
||||||
|
}
|
||||||
|
else if (Value=='compare') {
|
||||||
|
xaxis.show();
|
||||||
|
yaxis1.show();
|
||||||
|
yaxis2.hide();
|
||||||
|
x_param.hide();
|
||||||
|
y_param.hide();
|
||||||
|
groupby.hide();
|
||||||
|
spmmin.hide();
|
||||||
|
spmmax.hide();
|
||||||
|
workmin.hide();
|
||||||
|
workmax.hide();
|
||||||
|
plotfield.hide();
|
||||||
|
palette.hide();
|
||||||
|
binsize.hide();
|
||||||
|
plottype.show();
|
||||||
|
errorbars.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
@@ -545,6 +545,35 @@ def statsdata(workouts, options):
|
|||||||
|
|
||||||
return('',html_content)
|
return('',html_content)
|
||||||
|
|
||||||
|
def comparisondata(workouts,options):
|
||||||
|
includereststrokes = options['includereststrokes']
|
||||||
|
xparam = options['xaxis']
|
||||||
|
yparam1 = options['yaxis1']
|
||||||
|
plottype = options['plottype']
|
||||||
|
promember=True
|
||||||
|
|
||||||
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
|
ids = [w.id for w in workouts]
|
||||||
|
|
||||||
|
labeldict = {
|
||||||
|
int(w.id): w.__str__() for w in workouts
|
||||||
|
}
|
||||||
|
|
||||||
|
res = interactive_multiple_compare_chart(ids,xparam,yparam1,
|
||||||
|
promember=promember,
|
||||||
|
plottype=plottype,
|
||||||
|
labeldict=labeldict)
|
||||||
|
|
||||||
|
script = res[0]
|
||||||
|
div = res[1]
|
||||||
|
|
||||||
|
scripta = script.split('\n')[2:-1]
|
||||||
|
script = ''.join(scripta)
|
||||||
|
|
||||||
|
return(script,div)
|
||||||
|
|
||||||
|
|
||||||
def boxplotdata(workouts,options):
|
def boxplotdata(workouts,options):
|
||||||
|
|
||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
@@ -656,6 +685,8 @@ def analysis_view_data(request,userid=0):
|
|||||||
script,div = flexalldata(workouts,options)
|
script,div = flexalldata(workouts,options)
|
||||||
elif function == 'stats':
|
elif function == 'stats':
|
||||||
script,div = statsdata(workouts,options)
|
script,div = statsdata(workouts,options)
|
||||||
|
elif function == 'compare':
|
||||||
|
script,div = comparisondata(workouts,options)
|
||||||
else:
|
else:
|
||||||
script = ''
|
script = ''
|
||||||
div = 'Unknown analysis functions'
|
div = 'Unknown analysis functions'
|
||||||
|
|||||||
Reference in New Issue
Block a user