Private
Public Access
1
0

draft view and chart for multi comparison

This commit is contained in:
Sander Roosendaal
2017-02-18 11:55:14 +01:00
parent 33afb8800b
commit 46358ba4d4
6 changed files with 109 additions and 39 deletions

View File

@@ -52,7 +52,7 @@ import rowers.dataprep as dataprep
axlabels = {
'time': 'Time',
'distance': 'Distance (m)',
'cumdist': 'Distance (m)',
'cumdist': 'Cumulative Distance (m)',
'hr': 'Heart Rate (bpm)',
'spm': 'Stroke Rate (spm)',
'pace': 'Pace (/500m)',
@@ -1579,6 +1579,61 @@ def interactive_bar_chart(id=0,promember=0):
return [script,div]
def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line'):
columns = [xparam,yparam,
'ftime','distance','fpace',
'power','hr','spm',
'time','pace','workoutstate',
'workoutid']
datadf = dataprep.getsmallrowdata_db(columns,ids=ids)
yparamname = axlabels[yparam]
datadf = datadf[datadf[yparam] > 0]
datadf = datadf[datadf[xparam] > 0]
# check if dataframe not empty
if datadf.empty:
return ['','<p>No non-zero data in selection</p>','','']
if xparam=='distance':
xaxmax = datadf['distance'].max()
xaxmin = datadf['distance'].min()
else:
xaxmax = yaxmaxima[xparam]
xaxmin = yaxminima[xparam]
x_axis_type = 'linear'
y_axis_type = 'linear'
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
tools=TOOLS,
toolbar_location="above",
toolbar_sticky=False)
for key,grp in datadf.groupby(['workoutid']):
print key
script, div = components(plot)
return [script,div]
def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
promember=0,plottype='line'):