Private
Public Access
1
0

first version of box chart (wash only)

This commit is contained in:
Sander Roosendaal
2017-05-12 15:48:47 +02:00
parent 29f84d6e25
commit 50faf1ff1f
5 changed files with 71 additions and 6 deletions

View File

@@ -3834,7 +3834,7 @@ def workout_geeky_view(request,id=0,message="",successmessage=""):
# Cumulative stats page
@login_required()
def cumstats(request,theuser=0,
startdate=timezone.now()-datetime.timedelta(days=365),
startdate=timezone.now()-datetime.timedelta(days=30),
enddate=timezone.now(),
deltadays=-1,
startdatestring="",
@@ -3957,6 +3957,12 @@ def cumstats(request,theuser=0,
ids = [int(workout.id) for workout in allergworkouts]
datemapping = {
w.id:w.date for w in allergworkouts
}
fieldlist,fielddict = dataprep.getstatsfields()
# prepare data frame
@@ -3972,6 +3978,7 @@ def cumstats(request,theuser=0,
# Create stats
stats = {}
fielddict.pop('workoutstate')
fielddict.pop('workoutid')
for field,verbosename in fielddict.iteritems():
thedict = {
@@ -3998,8 +4005,13 @@ def cumstats(request,theuser=0,
except KeyError:
thedict[field2] = 0
cordict[field1] = thedict
cordict[field1] = thedict
# interactive box plot
datadf['workoutid'].replace(datemapping,inplace=True)
datadf.rename(columns={"workoutid":"date"},inplace=True)
script,div = interactive_boxchart(datadf,'wash')
# set options form correctly
initial = {}
initial['includereststrokes'] = includereststrokes
@@ -4027,6 +4039,8 @@ def cumstats(request,theuser=0,
'deltaform':deltaform,
'optionsform':optionsform,
'cordict':cordict,
'plotscript':script,
'plotdiv':div,
})
request.session['options'] = options