box plot
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "newbase.html" %}
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
{% load rowerfilters %}
|
{% load rowerfilters %}
|
||||||
|
|
||||||
{% block title %}Rowsandall Box Plot {% endblock %}
|
{% 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 type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
@@ -14,58 +14,34 @@
|
|||||||
<div id="id_script">
|
<div id="id_script">
|
||||||
</div>
|
</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>
|
|
||||||
|
|
||||||
|
<h1>Box Chart</h1>
|
||||||
<div class="grid_12 alpha">
|
<ul class="main-content">
|
||||||
<h1>Box Chart</h1>
|
<li class="grid_4">
|
||||||
<div id="workouts" class="grid_8 alpha">
|
<div id="id_chart">
|
||||||
<div id="id_chart" class="grid_8 alpha flexplot">
|
|
||||||
{{ the_div|safe }}
|
{{ the_div|safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
<div class="grid_4 omega">
|
<li class="grid_2">
|
||||||
<div class="grid_4">
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot/{{ userid }}" method="post">
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
{{ chartform.as_table }}
|
{{ chartform.as_table }}
|
||||||
</table>
|
</table>
|
||||||
<div class="grid_1 prefix_2 suffix_1">
|
<p>
|
||||||
<p>
|
<input name='workoutselectform' class="button green" type="submit" value="Submit">
|
||||||
<input name='workoutselectform' class="button green" type="submit" value="Submit">
|
</p>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</li>
|
||||||
<div class="grid_4">
|
<li class="grid_2">
|
||||||
<p>
|
<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
|
Set Min SPM and Max SPM to select only strokes in a certain range of
|
||||||
stroke rates.
|
stroke rates.
|
||||||
Set Work per Stroke to a minimum value to remove "paddle" strokes or turns.
|
Set Work per Stroke to a minimum value to remove "paddle" strokes or turns.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</li>
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -92,3 +68,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include 'menu_analytics.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -15,7 +15,13 @@
|
|||||||
|
|
||||||
<h1>Interactive Comparison</h1>
|
<h1>Interactive Comparison</h1>
|
||||||
<ul class="main-content">
|
<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">
|
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
@@ -27,12 +33,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_4">
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{{ the_div|safe }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
|
|
||||||
hidden.hide();
|
hidden.hide();
|
||||||
|
|
||||||
|
if (modality.val() == 'water') {
|
||||||
|
hidden.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup an event listener for when the state of the
|
// Setup an event listener for when the state of the
|
||||||
@@ -69,9 +72,15 @@
|
|||||||
|
|
||||||
|
|
||||||
<ul class="main-content">
|
<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">
|
<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 %}
|
{% if workouts %}
|
||||||
|
|
||||||
@@ -105,23 +114,13 @@
|
|||||||
<table>
|
<table>
|
||||||
{{ dateform.as_table }}
|
{{ dateform.as_table }}
|
||||||
</table>
|
</table>
|
||||||
|
<table>
|
||||||
|
{{ optionsform.as_table }}
|
||||||
|
</table>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
<input name='optionsform' class="button green" type="submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</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">
|
<li class="grid_2">
|
||||||
<form id="searchform" action=""
|
<form id="searchform" action=""
|
||||||
method="get" accept-charset="utf-8">
|
method="get" accept-charset="utf-8">
|
||||||
@@ -131,12 +130,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -164,9 +164,7 @@ urlpatterns = [
|
|||||||
url(r'^workouts-join-select/team/(?P<teamid>\d+)/$',views.workouts_join_select),
|
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/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.workouts_join_select),
|
||||||
url(r'^workouts-join-select/$',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+)/$',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/$',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+)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.user_multiflex_select),
|
||||||
url(r'^user-multiflex-select/user/(?P<userid>\d+)/$',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)
|
r = getrequestrower(request,userid=userid)
|
||||||
user = r.user
|
user = r.user
|
||||||
|
userid = user.id
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
options = request.session['options']
|
options = request.session['options']
|
||||||
@@ -5997,6 +5998,12 @@ def user_boxplot_select(request,
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
includereststrokes = False
|
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
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
@@ -6015,7 +6022,7 @@ def user_boxplot_select(request,
|
|||||||
startdate = s
|
startdate = s
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST' and 'daterange' in request.POST:
|
if request.method == 'POST':
|
||||||
dateform = DateRangeForm(request.POST)
|
dateform = DateRangeForm(request.POST)
|
||||||
if dateform.is_valid():
|
if dateform.is_valid():
|
||||||
startdate = dateform.cleaned_data['startdate']
|
startdate = dateform.cleaned_data['startdate']
|
||||||
@@ -6024,6 +6031,25 @@ def user_boxplot_select(request,
|
|||||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||||
request.session['startdate'] = startdatestring
|
request.session['startdate'] = startdatestring
|
||||||
request.session['enddate'] = enddatestring
|
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:
|
else:
|
||||||
dateform = DateRangeForm(initial={
|
dateform = DateRangeForm(initial={
|
||||||
'startdate':startdate,
|
'startdate':startdate,
|
||||||
@@ -6040,27 +6066,8 @@ def user_boxplot_select(request,
|
|||||||
modalities = [m[0] for m in types.workouttypes]
|
modalities = [m[0] for m in types.workouttypes]
|
||||||
modality = 'all'
|
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 = []
|
negtypes = []
|
||||||
for b in types.boattypes:
|
for b in types.boattypes:
|
||||||
@@ -6128,12 +6135,24 @@ def user_boxplot_select(request,
|
|||||||
request.session['startdate'] = startdatestring
|
request.session['startdate'] = startdatestring
|
||||||
request.session['enddate'] = enddatestring
|
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',
|
return render(request, 'user_boxplot_select.html',
|
||||||
{'workouts': workouts,
|
{'workouts': workouts,
|
||||||
'dateform':dateform,
|
'dateform':dateform,
|
||||||
'startdate':startdate,
|
'startdate':startdate,
|
||||||
'enddate':enddate,
|
'enddate':enddate,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
|
'breadcrumbs':breadcrumbs,
|
||||||
'theuser':user,
|
'theuser':user,
|
||||||
'form':form,
|
'form':form,
|
||||||
'active':'nav-analysis',
|
'active':'nav-analysis',
|
||||||
@@ -6305,7 +6324,7 @@ def boxplot_view(request,userid=0,
|
|||||||
else:
|
else:
|
||||||
return HttpResponse("invalid form")
|
return HttpResponse("invalid form")
|
||||||
else:
|
else:
|
||||||
url = reverse(user_boxplot_select)
|
url = reverse(user_boxplot_select,kwargs={'userid':userid})
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
div = get_call()
|
div = get_call()
|
||||||
@@ -6321,9 +6340,28 @@ def boxplot_view(request,userid=0,
|
|||||||
|
|
||||||
request.session['options'] = options
|
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',
|
return render(request,'boxplot.html',
|
||||||
{'interactiveplot':'',
|
{'interactiveplot':'',
|
||||||
'the_div':div,
|
'the_div':div,
|
||||||
|
'rower':r,
|
||||||
|
'breadcrumbs':breadcrumbs,
|
||||||
|
'active':'nav-analysis',
|
||||||
'chartform':chartform,
|
'chartform':chartform,
|
||||||
'userid':userid,
|
'userid':userid,
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
|
|||||||
Reference in New Issue
Block a user