Private
Public Access
1
0

added workflow view

This commit is contained in:
Sander Roosendaal
2017-10-13 14:10:53 +02:00
parent e806089ef7
commit 5ab1152825
9 changed files with 161 additions and 64 deletions

View File

@@ -2499,25 +2499,64 @@ def interactive_flex_chart2(id=0,promember=0,
return [script,div,js_resources,css_resources,workstrokesonly]
def thumbnail_flex_chart(id=0,promember=0,
xparam='time',
yparam1='pace',
yparam2='hr',
plottype='line',
workstrokesonly=False):
def thumbnails_set(r,id,favorites):
charts = []
columns = [f.xparam for f in favorites]
columns += [f.yparam1 for f in favorites]
columns += [f.yparam2 for f in favorites]
#rowdata,row = dataprep.getrowdata_db(id=id)
columns = [xparam,yparam1,yparam2,'time']
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
workstrokesonly=workstrokesonly)
columns += ['time']
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True)
rowdata.dropna(axis=1,how='all',inplace=True)
if rowdata.empty:
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
workstrokesonly=False)
workstrokesonly=False
return [
{'script':"",
'div':"",
'notes':""
}]
else:
try:
rowdata.sort_values(by='time',ascending=True,inplace=True)
except KeyError:
pass
l = len(rowdata)
maxlength = 50
if l > maxlength:
bins = np.linspace(rowdata['time'].min(),rowdata['time'].max(),maxlength)
groups = rowdata.groupby(np.digitize(rowdata['time'],bins))
rowdata = groups.mean()
for f in favorites:
workstrokesonly = not f.reststrokes
script,div = thumbnail_flex_chart(
rowdata,
id=id,
xparam=f.xparam,
yparam1=f.yparam1,
yparam2=f.yparam2,
plottype=f.plottype,
)
charts.append({
'script':script,
'div':div,
'notes':f.notes})
return charts
def thumbnail_flex_chart(rowdata,id=0,promember=0,
xparam='time',
yparam1='pace',
yparam2='hr',
plottype='line',
workstrokesonly=False):
try:
tests = rowdata[yparam2]
except KeyError:
@@ -2528,25 +2567,7 @@ def thumbnail_flex_chart(id=0,promember=0,
except KeyError:
yparam1 = 'None'
rowdata.dropna(axis=1,how='all',inplace=True)
if rowdata.empty:
return "","No valid data"
else:
try:
rowdata.sort_values(by='time',ascending=True,inplace=True)
except KeyError:
pass
workoutstateswork = [1,4,5,8,9,6,7]
workoutstatesrest = [3]
workoutstatetransition = [0,2,10,11,12,13]
if workstrokesonly:
try:
rowdata = rowdata[~rowdata['workoutstate'].isin(workoutstatesrest)]
except KeyError:
pass
try:
tseconds = rowdata.ix[:,'time']
@@ -2620,11 +2641,6 @@ def thumbnail_flex_chart(id=0,promember=0,
plot.yaxis.axis_label_text_font_size = "7pt"
plot.xaxis.major_label_text_font_size = "7pt"
plot.yaxis.major_label_text_font_size = "7pt"
# add watermark
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
if plottype=='line':
plot.line('x1','y1',source=source)