From 462e1e2f811c3b1156fe0adabf8a1cca88c6c2a5 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 24 May 2020 17:28:19 +0200 Subject: [PATCH] some small improvments --- rowers/interactiveplots.py | 22 ++++++++++++---------- rowers/views/workoutviews.py | 6 +++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index cf336baa..07a84620 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -5092,6 +5092,8 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line', deltas = [pair[1]-pair[0] for key,pair in startenddict.items()] xaxmin = 0 xaxmax = pd.Series(deltas).max()*1000. + if xaxmax == 0: + xaxmax = tseconds.max() else: xaxmax = datadf['distance'].max() xaxmin = datadf['distance'].min() @@ -5182,21 +5184,21 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line', 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 endsecond > 0: + 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] + elif xparam == 'distance': + group['distance'] = group['distance'] - group['distance'].min() + + try: group['x'] = group[xparam] except KeyError: diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index bf50dcd2..3af93c72 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -1542,7 +1542,11 @@ def virtualevent_compare_view(request,id=0): if request.method == 'GET': - xparam = race.sessionmode if race.sessionmode in ['distance','time'] else 'time' + xparam = 'time' + if race.sessionmode == 'distance': + xparam = 'cumdist' + + yparam = 'pace' plottype = 'line'