fix #454
This commit is contained in:
@@ -337,41 +337,8 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type'):
|
||||
p.toolbar_location = None
|
||||
p.sizing_mode = 'scale_width'
|
||||
|
||||
# p = hv.Bars(df,values='duration',
|
||||
# label = CatAttr(columns=['date'], sort=False),
|
||||
# xlabel='Date',
|
||||
# ylabel='Time',
|
||||
# title='Activity {d1} to {d2}'.format(
|
||||
# d1 = startdate.strftime("%Y-%m-%d"),
|
||||
# d2 = enddate.strftime("%Y-%m-%d"),
|
||||
# ),
|
||||
# stack=stack,
|
||||
# plot_width=350,
|
||||
# plot_height=250,
|
||||
# toolbar_location = None,
|
||||
# )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# for legend in p.legend:
|
||||
# new_items = []
|
||||
# for legend_item in legend.items:
|
||||
# it = legend_item.label['value']
|
||||
# tot = df[df[stack]==it].duration.sum()
|
||||
# if tot != 0:
|
||||
# new_items.append(legend_item)
|
||||
# legend.items = new_items
|
||||
|
||||
|
||||
# p.legend.location = "top_left"
|
||||
# p.legend.background_fill_alpha = 0.7
|
||||
#p.sizing_mode = 'scale_width'
|
||||
#p.sizing_mode = 'stretch_both'
|
||||
|
||||
#p.yaxis.axis_label = 'Minutes'
|
||||
|
||||
script,div = components(p)
|
||||
return script,div
|
||||
|
||||
@@ -786,55 +753,69 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
|
||||
plot.add_layout(avf)
|
||||
|
||||
peakflabel = Label(x=355,y=430,x_units='screen',y_units='screen',
|
||||
peakflabel = Label(x=410,y=460,x_units='screen',y_units='screen',
|
||||
text="Fpeak: {peakforceav:6.2f}".format(peakforceav=peakforceav),
|
||||
background_fill_alpha=.7,
|
||||
background_fill_color='white',
|
||||
text_color='blue',
|
||||
)
|
||||
|
||||
avflabel = Label(x=365,y=400,x_units='screen',y_units='screen',
|
||||
avflabel = Label(x=420,y=430,x_units='screen',y_units='screen',
|
||||
text="Favg: {averageforceav:6.2f}".format(averageforceav=averageforceav),
|
||||
background_fill_alpha=.7,
|
||||
background_fill_color='white',
|
||||
text_color='blue',
|
||||
)
|
||||
|
||||
catchlabel = Label(x=360,y=370,x_units='screen',y_units='screen',
|
||||
catchlabel = Label(x=415,y=400,x_units='screen',y_units='screen',
|
||||
text="Catch: {catchav:6.2f}".format(catchav=catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
peakforceanglelabel = Label(x=320,y=340,x_units='screen',y_units='screen',
|
||||
peakforceanglelabel = Label(x=375,y=370,x_units='screen',y_units='screen',
|
||||
text="Peak angle: {peakforceangleav:6.2f}".format(peakforceangleav=peakforceangleav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
finishlabel = Label(x=355,y=310,x_units='screen',y_units='screen',
|
||||
finishlabel = Label(x=410,y=340,x_units='screen',y_units='screen',
|
||||
text="Finish: {finishav:6.2f}".format(finishav=finishav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
sliplabel = Label(x=370,y=280,x_units='screen',y_units='screen',
|
||||
sliplabel = Label(x=425,y=310,x_units='screen',y_units='screen',
|
||||
text="Slip: {slipav:6.2f}".format(slipav=slipav-catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
washlabel = Label(x=360,y=250,x_units='screen',y_units='screen',
|
||||
washlabel = Label(x=415,y=280,x_units='screen',y_units='screen',
|
||||
text="Wash: {washav:6.2f}".format(washav=finishav-washav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
lengthlabel = Label(x=405,y=250, x_units='screen',y_units='screen',
|
||||
text="Length: {length:6.2f}".format(length=finishav-catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='green'
|
||||
)
|
||||
|
||||
efflengthlabel = Label(x=340,y=220, x_units='screen',y_units='screen',
|
||||
text="Effective Length: {length:6.2f}".format(length=washav-slipav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='green'
|
||||
)
|
||||
|
||||
annolabel = Label(x=50,y=450,x_units='screen',y_units='screen',
|
||||
text='',
|
||||
background_fill_alpha=0.7,
|
||||
@@ -859,6 +840,8 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
plot.add_layout(finishlabel)
|
||||
plot.add_layout(annolabel)
|
||||
plot.add_layout(sliderlabel)
|
||||
plot.add_layout(lengthlabel)
|
||||
plot.add_layout(efflengthlabel)
|
||||
|
||||
plot.xaxis.axis_label = "Angle"
|
||||
plot.yaxis.axis_label = "Force (N)"
|
||||
@@ -886,6 +869,8 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
peakforceanglelabel=peakforceanglelabel,
|
||||
annolabel=annolabel,
|
||||
sliderlabel=sliderlabel,
|
||||
lengthlabel=lengthlabel,
|
||||
efflengthlabel=efflengthlabel,
|
||||
plottype=plottype,
|
||||
sourcemultiline=sourcemultiline,
|
||||
sourcemultiline2=sourcemultiline2
|
||||
@@ -988,6 +973,9 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
dataslipwash['xslip'] = [catchav+slipav,finishav-washav]
|
||||
dataslipwash['yslip'] = [thresholdforce,thresholdforce]
|
||||
|
||||
var length = finishav-catchav
|
||||
var efflength = length-slipav-washav
|
||||
|
||||
avf.location = averageforceav
|
||||
avflabel.text = 'Favg: '+averageforceav.toFixed(2)
|
||||
catchlabel.text = 'Catch: '+catchav.toFixed(2)
|
||||
@@ -997,6 +985,8 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
peakflabel.text = 'Fpeak: '+peakforceav.toFixed(2)
|
||||
peakforceanglelabel.text = 'Peak angle: '+peakforceangleav.toFixed(2)
|
||||
annolabel.text = annotation
|
||||
lengthlabel.text = 'Length: '+length.toFixed(2)
|
||||
efflengthlabel.text = 'Effective Length: '+efflength.toFixed(2)
|
||||
|
||||
console.log(count);
|
||||
console.log(multilines['x'].length);
|
||||
@@ -1033,12 +1023,12 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
|
||||
|
||||
distmax = 100+100*int(rowdata['distance'].max()/100.)
|
||||
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=50,
|
||||
title="Min Distance",callback=callback)
|
||||
callback.args["mindist"] = slider_dist_min
|
||||
|
||||
slider_dist_max = Slider(start=0,end=distmax,value=distmax,
|
||||
step=1,
|
||||
step=50,
|
||||
title="Max Distance",callback=callback)
|
||||
callback.args["maxdist"] = slider_dist_max
|
||||
|
||||
@@ -3323,12 +3313,12 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
||||
except KeyError:
|
||||
distmax = 1000.
|
||||
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=50,
|
||||
title="Min Distance",callback=callback)
|
||||
callback.args["mindist"] = slider_dist_min
|
||||
|
||||
slider_dist_max = Slider(start=0,end=distmax,value=distmax,
|
||||
step=1,
|
||||
step=50,
|
||||
title="Max Distance",callback=callback)
|
||||
callback.args["maxdist"] = slider_dist_max
|
||||
|
||||
@@ -3925,12 +3915,12 @@ def interactive_flex_chart2(id=0,promember=0,
|
||||
except (KeyError,ValueError):
|
||||
distmax = 100
|
||||
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=50,
|
||||
title="Min Distance",callback=callback)
|
||||
callback.args["mindist"] = slider_dist_min
|
||||
|
||||
slider_dist_max = Slider(start=0,end=distmax,value=distmax,
|
||||
step=1,
|
||||
step=50,
|
||||
title="Max Distance",callback=callback)
|
||||
callback.args["maxdist"] = slider_dist_max
|
||||
|
||||
|
||||
Reference in New Issue
Block a user