Private
Public Access
1
0

start of UI for Analysis -> CP chart

This commit is contained in:
Sander Roosendaal
2020-10-11 13:47:44 +02:00
parent 49cbb57355
commit 88107530a5
3 changed files with 56 additions and 23 deletions

View File

@@ -1036,6 +1036,7 @@ analysischoices = (
('flexall','Cumulative Flex Chart'), ('flexall','Cumulative Flex Chart'),
('stats','Statistics'), ('stats','Statistics'),
('compare','Compare'), ('compare','Compare'),
('cp','CP chart'),
) )

View File

@@ -16,14 +16,14 @@
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script> <script>
$(function() { $(function() {
// Get the form fields and hidden div // Get the form fields and hidden div
var modality = $("#id_modality"); var modality = $("#id_modality");
var hidden = $("#id_waterboattype"); var hidden = $("#id_waterboattype");
// 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
// enabled. // enabled.
hidden.hide(); hidden.hide();
@@ -32,8 +32,8 @@
hidden.show(); hidden.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.
modality.change(function() { modality.change(function() {
// Check to see if the checkbox is checked. // Check to see if the checkbox is checked.
@@ -48,10 +48,10 @@
// Make sure that the hidden fields are indeed // Make sure that the hidden fields are indeed
// hidden. // hidden.
hidden.hide(); hidden.hide();
// You may also want to clear the value of the // You may also want to clear the value of the
// hidden fields here. Just in case somebody // hidden fields here. Just in case somebody
// shows the fields, enters data to them and then // shows the fields, enters data to them and then
// unticks the checkbox. // unticks the checkbox.
// //
// This would do the job: // This would do the job:
@@ -67,7 +67,7 @@
<script> <script>
// script for chart options form // script for chart options form
$(function() { $(function() {
// Get the form fields and hidden div // Get the form fields and hidden div
var functionfield = $("#id_function"); var functionfield = $("#id_function");
var plotfield = $("#id_plotfield").parent().parent(); var plotfield = $("#id_plotfield").parent().parent();
@@ -82,14 +82,16 @@
var spmmax = $("#id_spmmax").parent().parent(); var spmmax = $("#id_spmmax").parent().parent();
var workmin = $("#id_workmin").parent().parent(); var workmin = $("#id_workmin").parent().parent();
var workmax = $("#id_workmax").parent().parent(); var workmax = $("#id_workmax").parent().parent();
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(); var plottype = $("#id_plottype").parent().parent();
var reststrokes = $("#id_includereststrokes").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
// enabled. // enabled.
plotfield.hide(); plotfield.hide();
x_param.hide(); x_param.hide();
@@ -102,6 +104,7 @@
yaxis1.hide(); yaxis1.hide();
yaxis2.hide(); yaxis2.hide();
plottype.hide(); plottype.hide();
reststrokes.show();
if (functionfield.val() == 'boxplot') { if (functionfield.val() == 'boxplot') {
plotfield.show(); plotfield.show();
@@ -136,8 +139,8 @@
plottype.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.
functionfield.change(function() { functionfield.change(function() {
// Check to see if the checkbox is checked. // Check to see if the checkbox is checked.
@@ -161,6 +164,7 @@
yaxis1.hide(); yaxis1.hide();
yaxis2.hide(); yaxis2.hide();
plottype.hide(); plottype.hide();
reststrokes.show();
} }
else if (Value=='histo') { else if (Value=='histo') {
plotfield.show(); plotfield.show();
@@ -178,6 +182,7 @@
yaxis1.hide(); yaxis1.hide();
yaxis2.hide(); yaxis2.hide();
plottype.hide(); plottype.hide();
reststrokes.show();
} }
else if (Value=='trendflex') { else if (Value=='trendflex') {
@@ -196,6 +201,7 @@
yaxis1.hide(); yaxis1.hide();
yaxis2.hide(); yaxis2.hide();
plottype.hide(); plottype.hide();
reststrokes.show();
} }
else if (Value=='flexall') { else if (Value=='flexall') {
@@ -214,6 +220,7 @@
binsize.hide(); binsize.hide();
plottype.hide(); plottype.hide();
errorbars.hide(); errorbars.hide();
reststrokes.show();
} }
else if (Value=='stats') { else if (Value=='stats') {
xaxis.hide(); xaxis.hide();
@@ -227,6 +234,7 @@
binsize.hide(); binsize.hide();
errorbars.hide(); errorbars.hide();
plottype.hide(); plottype.hide();
reststrokes.show();
} }
else if (Value=='compare') { else if (Value=='compare') {
xaxis.show(); xaxis.show();
@@ -244,10 +252,29 @@
binsize.hide(); binsize.hide();
plottype.show(); plottype.show();
errorbars.hide(); errorbars.hide();
reststrokes.show();
}
else if (Value=='cp') {
plotfield.hide();
spmmin.hide();
spmmax.hide();
workmin.hide();
workmax.hide();
x_param.hide();
y_param.hide();
groupby.hide();
palette.hide();
binsize.hide();
errorbars.hide();
xaxis.hide();
yaxis1.hide();
yaxis2.hide();
plottype.hide();
reststrokes.hide();
} }
}); });
}); });
</script> </script>
<div id="id_css_res"> <div id="id_css_res">
@@ -285,9 +312,9 @@
<input type="submit" value="GO"></input> <input type="submit" value="GO"></input>
</form> </form>
<form enctype="multipart/form-data" action="" method="post"> <form enctype="multipart/form-data" action="" method="post">
{% if workouts %} {% if workouts %}
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/> <input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
<table width="100%" class="listtable"> <table width="100%" class="listtable">
{{ form.as_table }} {{ form.as_table }}

View File

@@ -500,6 +500,9 @@ def histodata(workouts, options):
return(script,div) return(script,div)
def cpdata(workouts, options):
return ('','Not Yet Implemented')
def statsdata(workouts, options): def statsdata(workouts, options):
includereststrokes = options['includereststrokes'] includereststrokes = options['includereststrokes']
spmmin = options['spmmin'] spmmin = options['spmmin']
@@ -725,6 +728,8 @@ def analysis_view_data(request,userid=0):
script,div = statsdata(workouts,options) script,div = statsdata(workouts,options)
elif function == 'compare': elif function == 'compare':
script,div = comparisondata(workouts,options) script,div = comparisondata(workouts,options)
elif function == 'cp':
script, div = cpdata(workouts, options)
else: else:
script = '' script = ''
div = 'Unknown analysis functions' div = 'Unknown analysis functions'
@@ -4849,7 +4854,7 @@ def history_view_data(request,userid=0):
typeselect = 'All' typeselect = 'All'
yaxis = request.GET.get('yaxis','duration') yaxis = request.GET.get('yaxis','duration')
if yaxis.lower() not in ['duration','rscore','trimp']: if yaxis.lower() not in ['duration','rscore','trimp']:
yaxis = 'duration' yaxis = 'duration'