Private
Public Access
1
0

OTW compare only uses data on course

This commit is contained in:
Sander Roosendaal
2020-05-24 17:11:41 +02:00
parent 36656b3c73
commit c3b404f8b6
2 changed files with 34 additions and 4 deletions

View File

@@ -5045,7 +5045,7 @@ def interactive_bar_chart(id=0,promember=0):
def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
promember=0,
labeldict=None):
labeldict=None,startenddict={}):
message = ''
errormessage = ''
@@ -5085,9 +5085,13 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
if xparam != 'distance' and xparam != 'time' and xparam != 'cumdist':
xaxmax = yaxmaxima[xparam]
xaxmin = yaxminima[xparam]
elif xparam == 'time':
elif xparam == 'time' and not startenddict:
xaxmax = tseconds.max()
xaxmin = tseconds.min()
elif xparam == 'time' and startenddict:
deltas = [pair[1]-pair[0] for key,pair in startenddict.items()]
xaxmin = 0
xaxmax = pd.Series(deltas).max()*1000.
else:
xaxmax = datadf['distance'].max()
xaxmin = datadf['distance'].min()
@@ -5170,10 +5174,27 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
for id,color in items:
group = datadf[datadf['workoutid']==int(id)].copy()
try:
startsecond,endsecond = startenddict[id]
except KeyError:
startsecond = 0
endsecond = 0
group.sort_values(by='time',ascending=True,inplace=True)
group['time'] = group['time'] - 1.e3*startsecond
mask = group['time'] < 0
group.mask(mask,inplace=True)
mask = group['time'] > 1.e3*(endsecond-startsecond)
group.mask(mask,inplace=True)
if xparam == 'cumdist':
group['cumdist'] = group['cumdist'] - group['cumdist'].min()
res = make_cumvalues(group[xparam])
group[xparam] = res[0]
try: