rough version of comparison
This commit is contained in:
@@ -1582,7 +1582,8 @@ def interactive_bar_chart(id=0,promember=0):
|
||||
return [script,div]
|
||||
|
||||
def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
promember=0):
|
||||
promember=0,
|
||||
labeldict=None):
|
||||
columns = [xparam,yparam,
|
||||
'ftime','distance','fpace',
|
||||
'power','hr','spm',
|
||||
@@ -1636,21 +1637,49 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
|
||||
tools=TOOLS,
|
||||
toolbar_location="above",
|
||||
plot_width=920,
|
||||
toolbar_sticky=False)
|
||||
|
||||
colors = itertools.cycle(palette)
|
||||
|
||||
cntr = 0
|
||||
|
||||
for id,color in itertools.izip(ids,colors):
|
||||
group = datadf[datadf['workoutid']==int(id)].copy()
|
||||
group.sort_values(by='time',ascending=True,inplace=True)
|
||||
group['x'] = group[xparam]
|
||||
group['y'] = group[yparam]
|
||||
|
||||
ymean = group['y'].mean()
|
||||
ylabel = Label(x=100,y=70+20*cntr,
|
||||
x_units='screen',y_units='screen',
|
||||
text=yparam+": {ymean:6.2f}".format(ymean=ymean),
|
||||
background_fill_alpha=.7,
|
||||
text_color=color,
|
||||
)
|
||||
if yparam != 'time' and yparam != 'pace':
|
||||
plot.add_layout(ylabel)
|
||||
|
||||
print cntr,id,len(group),ymean
|
||||
|
||||
source = ColumnDataSource(
|
||||
group
|
||||
)
|
||||
plot.line('x','y',source=source,color=color,legend=str(id))
|
||||
|
||||
plot.legend.location='top_left'
|
||||
if labeldict:
|
||||
legend=labeldict[id]
|
||||
else:
|
||||
legend=str(id)
|
||||
|
||||
if plottype=='line':
|
||||
plot.line('x','y',source=source,color=color,legend=legend)
|
||||
else:
|
||||
plot.scatter('x','y',source=source,color=color,legend=legend,
|
||||
fill_alpha=0.4,line_color=None)
|
||||
|
||||
cntr += 1
|
||||
|
||||
plot.legend.location='bottom_right'
|
||||
plot.xaxis.axis_label = axlabels[xparam]
|
||||
plot.yaxis.axis_label = axlabels[yparam]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user