added histogram
need to filter on spm, wps
This commit is contained in:
@@ -157,7 +157,7 @@ ratelim==0.1.6
|
||||
redis==3.2.1
|
||||
requests==2.21.0
|
||||
requests-oauthlib==1.2.0
|
||||
rowingdata==2.2.7
|
||||
rowingdata==2.3.1
|
||||
rowingphysics==0.5.0
|
||||
rq==1.0
|
||||
rq-dashboard==0.4.0
|
||||
|
||||
@@ -840,6 +840,7 @@ palettechoices = tuple((p,p) for p in palettes.keys())
|
||||
analysischoices = (
|
||||
('boxplot','Box Chart'),
|
||||
('trendflex','Trend Flex'),
|
||||
('histo','Histogram'),
|
||||
)
|
||||
|
||||
class AnalysisChoiceForm(forms.Form):
|
||||
|
||||
@@ -1225,14 +1225,14 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes):
|
||||
rowdata.dropna(axis=0,how='any',inplace=True)
|
||||
|
||||
if rowdata.empty:
|
||||
return "","No Valid Data Available","",""
|
||||
return "","No Valid Data Available"
|
||||
|
||||
try:
|
||||
histopwr = rowdata[histoparam].values
|
||||
except KeyError:
|
||||
return "","No data","",""
|
||||
return "","No data"
|
||||
if len(histopwr) == 0:
|
||||
return "","No valid data available","",""
|
||||
return "","No valid data available"
|
||||
|
||||
# throw out nans
|
||||
histopwr = histopwr[~np.isinf(histopwr)]
|
||||
@@ -1341,7 +1341,6 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes):
|
||||
script = ''
|
||||
div = ''
|
||||
|
||||
|
||||
return [script,div]
|
||||
|
||||
def course_map(course):
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
plotfield.show();
|
||||
};
|
||||
|
||||
if (functionfield.val() == 'histo') {
|
||||
plotfield.show()
|
||||
}
|
||||
|
||||
if (functionfield.val() == 'trendflex') {
|
||||
x_param.show();
|
||||
y_param.show();
|
||||
@@ -119,7 +123,16 @@
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
errorbars.hide();
|
||||
}
|
||||
}
|
||||
else if (Value=='histo') {
|
||||
plotfield.show();
|
||||
x_param.hide();
|
||||
y_param.hide();
|
||||
groupby.hide();
|
||||
palette.hide();
|
||||
binsize.hide();
|
||||
errorbars.hide();
|
||||
}
|
||||
else if (Value=='trendflex') {
|
||||
x_param.show();
|
||||
y_param.show();
|
||||
@@ -135,7 +148,15 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
||||
<div id="id_css_res">
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.css" type="text/css" />
|
||||
</div>
|
||||
<div id="id_js_res">
|
||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.js"></script>
|
||||
</div>
|
||||
|
||||
<script async="true" type="text/javascript">
|
||||
Bokeh.set_log_level("info");
|
||||
</script>
|
||||
|
||||
@@ -24,11 +24,13 @@ def analysis_new(request,userid=0,function='boxplot'):
|
||||
user = r.user
|
||||
userid = user.id
|
||||
|
||||
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
else:
|
||||
options=defaultoptions
|
||||
|
||||
options['userid'] = userid
|
||||
try:
|
||||
workouttypes = options['workouttypes']
|
||||
except KeyError:
|
||||
@@ -409,7 +411,23 @@ def trendflexdata(workouts, options,userid=0):
|
||||
script = ''.join(scripta)
|
||||
|
||||
return(script,div)
|
||||
|
||||
def histodata(workouts, options):
|
||||
includereststrokes = options['includereststrokes']
|
||||
plotfield = options['plotfield']
|
||||
function = options['function']
|
||||
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
script, div = interactive_histoall(workouts,plotfield,includereststrokes)
|
||||
|
||||
|
||||
scripta = script.split('\n')[2:-1]
|
||||
script = ''.join(scripta)
|
||||
|
||||
return(script,div)
|
||||
|
||||
|
||||
def boxplotdata(workouts,options):
|
||||
|
||||
|
||||
@@ -516,6 +534,8 @@ def analysis_view_data(request,userid=0):
|
||||
script, div = boxplotdata(workouts,options)
|
||||
elif function == 'trendflex':
|
||||
script, div = trendflexdata(workouts, options,userid=userid)
|
||||
elif function == 'histo':
|
||||
script, div = histodata(workouts, options)
|
||||
else:
|
||||
script = ''
|
||||
div = 'Unknown analysis functions'
|
||||
|
||||
Reference in New Issue
Block a user