activity chart on history page can be switched to rscore or trimp
This commit is contained in:
@@ -602,13 +602,17 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type',toolbar_lo
|
||||
script,div = components(p)
|
||||
return script,div
|
||||
|
||||
def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_location=None):
|
||||
def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_location=None,
|
||||
yaxis='duration'):
|
||||
|
||||
|
||||
dates = []
|
||||
dates_sorting = []
|
||||
types = []
|
||||
rowers = []
|
||||
durations = []
|
||||
rscores = []
|
||||
trimps = []
|
||||
links = []
|
||||
|
||||
|
||||
@@ -643,6 +647,10 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
dd2 = w.date.strftime('%Y/%m/%d')
|
||||
dd3 = w.date.strftime('%Y/%m')
|
||||
du = w.duration.hour*60+w.duration.minute
|
||||
trimp = w.trimp
|
||||
rscore = w.rscore
|
||||
if rscore == 0:
|
||||
rscore = w.hrtss
|
||||
|
||||
if totaldays<30:
|
||||
dates.append(dd)
|
||||
@@ -651,6 +659,8 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
dates.append(dd3)
|
||||
dates_sorting.append(dd3)
|
||||
durations.append(du)
|
||||
trimps.append(trimp)
|
||||
rscores.append(rscore)
|
||||
links.append(
|
||||
"{siteurl}/rowers/workout/{code}/".format(
|
||||
siteurl = settings.SITE_URL,
|
||||
@@ -687,6 +697,8 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
dates.append(d.strftime('%Y/%m'))
|
||||
dates_sorting.append(d.strftime('%Y/%m'))
|
||||
durations.append(0)
|
||||
trimps.append(0)
|
||||
rscores.append(0)
|
||||
links.append('')
|
||||
types.append('rower')
|
||||
|
||||
@@ -705,6 +717,8 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
'date':dates,
|
||||
'date_sorting':dates_sorting,
|
||||
'duration':durations,
|
||||
'trimp':trimps,
|
||||
'rscore':rscores,
|
||||
'type':types,
|
||||
'rower':rowers,
|
||||
'link':links,
|
||||
@@ -723,10 +737,12 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
hv.extension('bokeh')
|
||||
|
||||
|
||||
table = hv.Table(df,[('date','Date'),('type','Workout Type')],[('duration','Minutes'),('link','link')])
|
||||
table = hv.Table(df,[('date','Date'),('type','Workout Type')],
|
||||
[('duration','Minutes'),('trimp','TRIMP'),('rscore','rScore'),('link','link')])
|
||||
|
||||
|
||||
bars=table.to.bars(['date',stack],['duration'])
|
||||
bars=table.to.bars(['date',stack],[yaxis])
|
||||
|
||||
bars.opts(
|
||||
opts.Bars(color=dim_expr, show_legend=True, stacked=True,
|
||||
tools=['tap','hover'], width=550, xrotation=45,padding=(0,(0,.1)),
|
||||
@@ -745,6 +761,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
p.plot_height=350
|
||||
p.toolbar_location = toolbar_location
|
||||
p.sizing_mode = 'scale_width'
|
||||
p.y_range.start = 0
|
||||
url = "http://rowsandall.com/rowers/workout/@duration/"
|
||||
taptool = p.select(type=TapTool)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user