Merge branch 'release/v3.45'
This commit is contained in:
@@ -1314,7 +1314,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
|
|||||||
|
|
||||||
|
|
||||||
for nr, gvalue, color in colorlegend:
|
for nr, gvalue, color in colorlegend:
|
||||||
box = BoxAnnotation(bottom=500-20*nr,left=550,top=520-20*nr,
|
box = BoxAnnotation(bottom=400+20*nr,left=550,top=420+20*nr,
|
||||||
right=570,
|
right=570,
|
||||||
bottom_units='screen',
|
bottom_units='screen',
|
||||||
top_units='screen',
|
top_units='screen',
|
||||||
@@ -1323,7 +1323,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
|
|||||||
fill_color=color,
|
fill_color=color,
|
||||||
fill_alpha=1.0,
|
fill_alpha=1.0,
|
||||||
line_color=color)
|
line_color=color)
|
||||||
legendlabel = Label(x=571,y=503-20*nr,x_units='screen',
|
legendlabel = Label(x=571,y=403+20*nr,x_units='screen',
|
||||||
y_units='screen',
|
y_units='screen',
|
||||||
text = "{gvalue:3.0f}".format(gvalue=gvalue),
|
text = "{gvalue:3.0f}".format(gvalue=gvalue),
|
||||||
background_fill_alpha=1.0,
|
background_fill_alpha=1.0,
|
||||||
|
|||||||
+55
-5
@@ -3344,6 +3344,27 @@ def user_multiflex_select(request,
|
|||||||
|
|
||||||
r = getrower(user)
|
r = getrower(user)
|
||||||
|
|
||||||
|
if 'options' in request.session:
|
||||||
|
options = request.session['options']
|
||||||
|
else:
|
||||||
|
options = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
palette = request.session['palette']
|
||||||
|
except KeyError:
|
||||||
|
palette = 'monochrome_blue'
|
||||||
|
|
||||||
|
try:
|
||||||
|
includereststrokes = request.session['includereststrokes']
|
||||||
|
except KeyError:
|
||||||
|
includereststrokes = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
ploterrorbars = request.session['ploterrorbars']
|
||||||
|
except:
|
||||||
|
ploterrobars = False
|
||||||
|
|
||||||
|
|
||||||
if 'startdate' in request.session:
|
if 'startdate' in request.session:
|
||||||
startdate = iso8601.parse_date(request.session['startdate'])
|
startdate = iso8601.parse_date(request.session['startdate'])
|
||||||
|
|
||||||
@@ -3395,7 +3416,11 @@ def user_multiflex_select(request,
|
|||||||
form = WorkoutMultipleCompareForm()
|
form = WorkoutMultipleCompareForm()
|
||||||
form.fields["workouts"].queryset = workouts
|
form.fields["workouts"].queryset = workouts
|
||||||
|
|
||||||
chartform = MultiFlexChoiceForm()
|
chartform = MultiFlexChoiceForm(initial={
|
||||||
|
'palette':palette,
|
||||||
|
'ploterrorbars':ploterrorbars,
|
||||||
|
'includereststrokes':includereststrokes,
|
||||||
|
})
|
||||||
|
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
@@ -3437,9 +3462,9 @@ def multiflex_view(request,userid=0,
|
|||||||
ploterrorbars = False
|
ploterrorbars = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
palette = options['palette']
|
palette = request.session['palette']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
palette = 'blue_green'
|
palette = 'monochrome_blue'
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
@@ -3579,6 +3604,20 @@ def multiflex_view(request,userid=0,
|
|||||||
yerror = groups.std()[yparam]
|
yerror = groups.std()[yparam]
|
||||||
groupsize = groups.count()[xparam]
|
groupsize = groups.count()[xparam]
|
||||||
|
|
||||||
|
mask = groupsize <= max([0.0003*groupsize.sum(),0.2*groupsize.mean()])
|
||||||
|
xvalues.loc[mask] = np.nan
|
||||||
|
yvalues.loc[mask] = np.nan
|
||||||
|
xerror.loc[mask] = np.nan
|
||||||
|
yerror.loc[mask] = np.nan
|
||||||
|
groupsize.loc[mask] = np.nan
|
||||||
|
|
||||||
|
xvalues.dropna(inplace=True)
|
||||||
|
yvalues.dropna(inplace=True)
|
||||||
|
xerror.dropna(inplace=True)
|
||||||
|
yerror.dropna(inplace=True)
|
||||||
|
groupsize.dropna(inplace=True)
|
||||||
|
|
||||||
|
|
||||||
if len(groupsize) == 0:
|
if len(groupsize) == 0:
|
||||||
messages.error(request,'No data in selection')
|
messages.error(request,'No data in selection')
|
||||||
url = reverse(user_multiflex_select)
|
url = reverse(user_multiflex_select)
|
||||||
@@ -3598,10 +3637,13 @@ def multiflex_view(request,userid=0,
|
|||||||
|
|
||||||
if groupby != 'date':
|
if groupby != 'date':
|
||||||
try:
|
try:
|
||||||
df['groupval'] = groups.mean()[groupby],
|
df['groupval'] = groups.mean()[groupby]
|
||||||
|
df['groupval'].loc[mask] = np.nan
|
||||||
|
|
||||||
groupcols = df['groupval']
|
groupcols = df['groupval']
|
||||||
except ValueError:
|
except ValueError:
|
||||||
df['groupval'] = groups.mean()[groupby].fillna(value=0)
|
df['groupval'] = groups.mean()[groupby].fillna(value=0)
|
||||||
|
df['groupval'].loc[mask] = np.nan
|
||||||
groupcols = df['groupval']
|
groupcols = df['groupval']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
messages.error(request,'Data selection error')
|
messages.error(request,'Data selection error')
|
||||||
@@ -3609,7 +3651,11 @@ def multiflex_view(request,userid=0,
|
|||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
df['groupval'] = [x.strftime("%Y-%m-%d") for x in groups.min()[groupby]]
|
dates = groups.min()[groupby]
|
||||||
|
dates.loc[mask] = np.nan
|
||||||
|
dates.dropna(inplace=True)
|
||||||
|
df['groupval'] = [x.strftime("%Y-%m-%d") for x in dates]
|
||||||
|
df['groupval'].loc[mask] = np.nan
|
||||||
groupcols = 100.*np.arange(aantal)/float(aantal)
|
groupcols = 100.*np.arange(aantal)/float(aantal)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
df['groupval'] = groups.mean()['days ago'].fillna(value=0)
|
df['groupval'] = groups.mean()['days ago'].fillna(value=0)
|
||||||
@@ -3627,7 +3673,11 @@ def multiflex_view(request,userid=0,
|
|||||||
|
|
||||||
clegendx = np.arange(0,1.2,.2)
|
clegendx = np.arange(0,1.2,.2)
|
||||||
legcolors = range_to_color_hex(clegendx,palette=palette)
|
legcolors = range_to_color_hex(clegendx,palette=palette)
|
||||||
|
if groupby != 'date':
|
||||||
clegendy = df['groupval'].min()+clegendx*(df['groupval'].max()-df['groupval'].min())
|
clegendy = df['groupval'].min()+clegendx*(df['groupval'].max()-df['groupval'].min())
|
||||||
|
else:
|
||||||
|
clegendy = df.index.min()+clegendx*(df.index.max()-df.index.min())
|
||||||
|
print clegendy
|
||||||
|
|
||||||
|
|
||||||
colorlegend = zip(range(6),clegendy,legcolors)
|
colorlegend = zip(range(6),clegendy,legcolors)
|
||||||
|
|||||||
Reference in New Issue
Block a user