Private
Public Access
1
0

adding athlete names to analysis

This commit is contained in:
Sander Roosendaal
2022-09-15 12:11:06 +02:00
parent a68e571010
commit 6beae2ca37
5 changed files with 50 additions and 8 deletions

View File

@@ -365,6 +365,9 @@ def interactive_boxchart(datadf, fieldname, extratitle='',
plot.y_range = yrange1
plot.sizing_mode = 'stretch_both'
if extratitle:
plot.title.text = extratitle
plot.xaxis.axis_label = 'Date'
plot.yaxis.axis_label = axlabels[fieldname]
@@ -1970,6 +1973,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
def interactive_histoall(theworkouts, histoparam, includereststrokes,
spmmin=0, spmmax=55,
extratitle='',
workmin=0, workmax=1500):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -2013,6 +2017,10 @@ def interactive_histoall(theworkouts, histoparam, includereststrokes,
toolbar_location="above"
)
if extratitle:
plot.title.text = extratitle
# add watermark
watermarkurl = "/static/img/logo7.png"
watermarkrange = Range1d(start=0, end=1)
@@ -4470,6 +4478,9 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
gr=groupname,
)
if extratitle is not None:
title = title+' '+extratitle
if xparam == 'cumdist': # pragma: no cover
res = make_cumvalues(datadf[xparam])
datadf[xparam] = res[0]
@@ -4659,6 +4670,7 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
yparam1='power',
yparam2='spm',
workstrokesonly=False,
extratitle='',
trendline=False):
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
@@ -4789,6 +4801,10 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'stretch_both'
if extratitle:
plot.title.text = extratitle
plot.image_url([watermarkurl], watermarkx, watermarky,
watermarkw, watermarkh,
global_alpha=watermarkalpha,

View File

@@ -1,6 +1,6 @@
{% if stats %}
<h2>Statistics</h2>
<h2>Statistics {{ extratitle }}</h2>
<table width="100%" class="listtable">
<thead>
<tr>
@@ -28,7 +28,7 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>
{% endif %}
@@ -67,10 +67,6 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>
{% endif %}

View File

@@ -528,7 +528,7 @@
<script>
$(function($) {
console.log('loading script');
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/analysisdata/', function(json) {
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/analysisdata/user/{{ rower.user.id }}', function(json) {
var counter=0;
var script = json.script;
var div = json.div;

View File

@@ -419,6 +419,8 @@ urlpatterns = [
re_path(r'^ote-bests2/user/(?P<userid>\d+)/$',
views.rankings_view2, name='rankings_view2'),
re_path(r'^ote-bests2/$', views.rankings_view2, name='rankings_view2'),
re_path(r'^analysisdata/user/(?P<userid>\d+)/$', views.analysis_view_data,
name='analysis_view_data'),
re_path(r'^analysisdata/$', views.analysis_view_data,
name='analysis_view_data'),
re_path(r'^graph/(?P<id>\d+)/$',

View File

@@ -459,6 +459,7 @@ def trendflexdata(workouts, options, userid=0):
u = User.objects.get(id=userid)
extratitle = ' '+u.first_name+' '+u.last_name
script, div = interactive_multiflex(df, xparam, yparam,
groupby,
extratitle=extratitle,
@@ -484,10 +485,19 @@ def flexalldata(workouts, options):
workstrokesonly = not includereststrokes
userid = options['userid']
if userid == 0: # pragma: no cover
extratitle = ''
else:
u = User.objects.get(id=userid)
extratitle = ' '+u.first_name+' '+u.last_name
res = interactive_cum_flex_chart2(workouts, xparam=xparam,
yparam1=yparam1,
yparam2=yparam2,
promember=promember,
extratitle=extratitle,
workstrokesonly=workstrokesonly,
trendline=trendline,
)
@@ -507,9 +517,18 @@ def histodata(workouts, options):
spmmax = options['spmmax']
workmin = options['workmin']
workmax = options['workmax']
userid = options['userid']
if userid == 0: # pragma: no cover
extratitle = ''
else:
u = User.objects.get(id=userid)
extratitle = ' '+u.first_name+' '+u.last_name
script, div = interactive_histoall(workouts, plotfield, includereststrokes,
spmmin=spmmin, spmmax=spmmax,
extratitle=extratitle,
workmin=workmin, workmax=workmax)
scripta = script.split('\n')[2:-1]
@@ -675,6 +694,14 @@ def statsdata(workouts, options):
includereststrokes = options['includereststrokes']
ids = options['ids']
userid = options['userid']
if userid == 0: # pragma: no cover
extratitle = ''
else:
u = User.objects.get(id=userid)
extratitle = ' '+u.first_name+' '+u.last_name
workstrokesonly = not includereststrokes
ids = [w.id for w in workouts]
@@ -728,6 +755,7 @@ def statsdata(workouts, options):
context = {
'stats': stats,
'cordict': cordict,
'extratitle': extratitle,
}
htmly = env.get_template('statsdiv.html')