box plot
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Rowsandall Box Plot {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
|
||||
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||
<script async="true" type="text/javascript">
|
||||
@@ -14,58 +14,34 @@
|
||||
<div id="id_script">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Set things up to resize the plot on a window resize. You can play with
|
||||
// the arguments of resize_width_height() to change the plot's behavior.
|
||||
var plot_resize_setup = function () {
|
||||
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
||||
var plot = Bokeh.index[plotid];
|
||||
var plotresizer = function() {
|
||||
// arguments: use width, use height, maintain aspect ratio
|
||||
plot.resize_width_height(true, false, false);
|
||||
};
|
||||
window.addEventListener('resize', plotresizer);
|
||||
plotresizer();
|
||||
};
|
||||
window.addEventListener('load', plot_resize_setup);
|
||||
</script>
|
||||
<style>
|
||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||
html, body {height: 100%; margin:5px;}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
<h1>Box Chart</h1>
|
||||
<div id="workouts" class="grid_8 alpha">
|
||||
<div id="id_chart" class="grid_8 alpha flexplot">
|
||||
<h1>Box Chart</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
<div id="id_chart">
|
||||
{{ the_div|safe }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_4 omega">
|
||||
<div class="grid_4">
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot/{{ userid }}" method="post">
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ chartform.as_table }}
|
||||
</table>
|
||||
<div class="grid_1 prefix_2 suffix_1">
|
||||
<p>
|
||||
<input name='workoutselectform' class="button green" type="submit" value="Submit">
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
<input name='workoutselectform' class="button green" type="submit" value="Submit">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="grid_4">
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<p>
|
||||
You can use the form above to change the metric or filter the data.
|
||||
You can use the form to change the metric or filter the data.
|
||||
Set Min SPM and Max SPM to select only strokes in a certain range of
|
||||
stroke rates.
|
||||
Set Work per Stroke to a minimum value to remove "paddle" strokes or turns.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -92,3 +68,7 @@
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_analytics.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
|
||||
<h1>Interactive Comparison</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<li class="grid_4">
|
||||
|
||||
<div>
|
||||
{{ the_div|safe }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
@@ -27,12 +33,6 @@
|
||||
</p>
|
||||
</form>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
|
||||
<div>
|
||||
{{ the_div|safe }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
hidden.hide();
|
||||
|
||||
if (modality.val() == 'water') {
|
||||
hidden.show();
|
||||
}
|
||||
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
@@ -69,9 +72,15 @@
|
||||
|
||||
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
<p>You can use the date and search forms to search through all
|
||||
workouts from this team.</p>
|
||||
<p>TIP: Agree with your team members to put tags (e.g. '8x500m') in the notes section of
|
||||
your workouts. That makes it easy to search.</p>
|
||||
</li>
|
||||
|
||||
<li class="grid_2 maxheight">
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot/{{ theuser.id }}" method="post">
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot/user/{{ theuser.id }}" method="post">
|
||||
|
||||
{% if workouts %}
|
||||
|
||||
@@ -105,23 +114,13 @@
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
<table>
|
||||
{{ optionsform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||
<input name='optionsform' class="button green" type="submit" value="Submit">
|
||||
</form>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
{% if theuser %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/user/{{ theuser.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/" method="post">
|
||||
{% endif %}
|
||||
<table>
|
||||
{{ optionsform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input name='optionsform' class="button green" type="submit" value="Submit">
|
||||
</form>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<form id="searchform" action=""
|
||||
method="get" accept-charset="utf-8">
|
||||
@@ -131,12 +130,6 @@
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<p>You can use the date and search forms above to search through all
|
||||
workouts from this team.</p>
|
||||
<p>TIP: Agree with your team members to put tags (e.g. '8x500m') in the notes section of
|
||||
your workouts. That makes it easy to search.</p>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -164,9 +164,7 @@ urlpatterns = [
|
||||
url(r'^workouts-join-select/team/(?P<teamid>\d+)/$',views.workouts_join_select),
|
||||
url(r'^workouts-join-select/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.workouts_join_select),
|
||||
url(r'^workouts-join-select/$',views.workouts_join_select),
|
||||
url(r'^user-boxplot-select/user/(?P<userid>\d+)$',views.user_boxplot_select),
|
||||
url(r'^user-boxplot-select/user/(?P<userid>\d+)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.user_boxplot_select),
|
||||
url(r'^user-boxplot-select/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.user_boxplot_select),
|
||||
url(r'^user-boxplot-select/user/(?P<userid>\d+)/$',views.user_boxplot_select),
|
||||
url(r'^user-boxplot-select/$',views.user_boxplot_select),
|
||||
url(r'^user-multiflex-select/user/(?P<userid>\d+)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.user_multiflex_select),
|
||||
url(r'^user-multiflex-select/user/(?P<userid>\d+)/$',views.user_multiflex_select),
|
||||
|
||||
@@ -5977,6 +5977,7 @@ def user_boxplot_select(request,
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
user = r.user
|
||||
userid = user.id
|
||||
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
@@ -5997,6 +5998,12 @@ def user_boxplot_select(request,
|
||||
except KeyError:
|
||||
includereststrokes = False
|
||||
|
||||
if 'startdate' in request.session:
|
||||
startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
if 'enddate' in request.session:
|
||||
enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
@@ -6015,7 +6022,7 @@ def user_boxplot_select(request,
|
||||
startdate = s
|
||||
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
if request.method == 'POST':
|
||||
dateform = DateRangeForm(request.POST)
|
||||
if dateform.is_valid():
|
||||
startdate = dateform.cleaned_data['startdate']
|
||||
@@ -6024,6 +6031,25 @@ def user_boxplot_select(request,
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
optionsform = TrendFlexModalForm(request.POST)
|
||||
if optionsform.is_valid():
|
||||
modality = optionsform.cleaned_data['modality']
|
||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
if 'rankingonly' in optionsform.cleaned_data:
|
||||
rankingonly = optionsform.cleaned_data['rankingonly']
|
||||
else:
|
||||
rankingonly = False
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
else:
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
@@ -6040,27 +6066,8 @@ def user_boxplot_select(request,
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
modality = 'all'
|
||||
|
||||
if request.method == 'POST' and 'optionsform' in request.POST:
|
||||
optionsform = TrendFlexModalForm(request.POST)
|
||||
if optionsform.is_valid():
|
||||
modality = optionsform.cleaned_data['modality']
|
||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
if 'rankingonly' in optionsform.cleaned_data:
|
||||
rankingonly = optionsform.cleaned_data['rankingonly']
|
||||
else:
|
||||
rankingonly = False
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
|
||||
negtypes = []
|
||||
for b in types.boattypes:
|
||||
@@ -6128,12 +6135,24 @@ def user_boxplot_select(request,
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
|
||||
r = getrower(request.user)
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':reverse(user_boxplot_select,kwargs={'userid':userid}),
|
||||
'name': 'BoxPlot Select'
|
||||
},
|
||||
]
|
||||
return render(request, 'user_boxplot_select.html',
|
||||
{'workouts': workouts,
|
||||
'dateform':dateform,
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
'rower':r,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'theuser':user,
|
||||
'form':form,
|
||||
'active':'nav-analysis',
|
||||
@@ -6305,7 +6324,7 @@ def boxplot_view(request,userid=0,
|
||||
else:
|
||||
return HttpResponse("invalid form")
|
||||
else:
|
||||
url = reverse(user_boxplot_select)
|
||||
url = reverse(user_boxplot_select,kwargs={'userid':userid})
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
div = get_call()
|
||||
@@ -6321,9 +6340,28 @@ def boxplot_view(request,userid=0,
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':reverse(user_boxplot_select,kwargs={'userid':userid}),
|
||||
'name': 'BoxPlot Select'
|
||||
},
|
||||
{
|
||||
'url':reverse(boxplot_view,kwargs={'userid':userid}),
|
||||
'name': 'BoxPlot Select'
|
||||
},
|
||||
]
|
||||
|
||||
return render(request,'boxplot.html',
|
||||
{'interactiveplot':'',
|
||||
'the_div':div,
|
||||
'rower':r,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'active':'nav-analysis',
|
||||
'chartform':chartform,
|
||||
'userid':userid,
|
||||
'teams':get_my_teams(request.user),
|
||||
|
||||
Reference in New Issue
Block a user