diff --git a/requirements.txt b/requirements.txt index c8108737..d7f1e8b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/rowers/forms.py b/rowers/forms.py index 4e1d910c..173bf4b7 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -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): diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 01146381..64a18653 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -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): diff --git a/rowers/templates/user_analysis_select.html b/rowers/templates/user_analysis_select.html index c5ee4387..6b8a8e95 100644 --- a/rowers/templates/user_analysis_select.html +++ b/rowers/templates/user_analysis_select.html @@ -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 @@ }); - +
+ + +
+
+ + +
+ diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index dcb5a610..f5cd3a77 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -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'