Merge branch 'release/v16.4.1'
This commit is contained in:
@@ -796,24 +796,38 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
|
||||
dim_expr = hv.dim('type').categorize(mytypes.color_map)
|
||||
|
||||
|
||||
|
||||
df = pd.DataFrame(thedict)
|
||||
|
||||
if totaldays>30 and yaxis=='duration': # pragma: no cover
|
||||
df['duration'] = df['duration']/60
|
||||
elif yaxis == 'TRIMP':
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('rscore',inplace=True,axis='columns')
|
||||
elif yaxis == 'rScore': # pragma: no cover
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('trimp',inplace=True,axis='columns' )
|
||||
|
||||
df['color'] = df['type'].apply(lambda x:mapcolors(x))
|
||||
|
||||
df.sort_values('date_sorting',inplace=True)
|
||||
|
||||
#clrs = hv.Cycle(df['colors'].values)
|
||||
source = ColumnDataSource(df)
|
||||
|
||||
hv.extension('bokeh')
|
||||
|
||||
|
||||
table = hv.Table(df,[('date','Date'),('type','Workout Type')],
|
||||
[('duration','Minutes'),('trimp','TRIMP'),('rscore','rScore'),('link','link')])
|
||||
|
||||
|
||||
bars=table.to.bars(['date',stack],[yaxis])
|
||||
#table = hv.Table(df,[('date','Date'),('type','Workout Type')],
|
||||
# [('duration','Minutes'),('trimp','TRIMP'),('rscore','rScore'),('link','link')])
|
||||
|
||||
types_order = mytypes.workouttypes_ordered
|
||||
#bars=table.to.bars(['date',stack],[yaxis])
|
||||
bars = hv.Bars(df, kdims=['date',stack]).aggregate(function=np.sum)
|
||||
|
||||
|
||||
#print(mytypes.color_map)
|
||||
bars.opts(
|
||||
opts.Bars(cmap=mytypes.color_map, show_legend=True, stacked=True,
|
||||
tools=['tap','hover'], width=550, xrotation=45,padding=(0,(0,.1)),
|
||||
@@ -829,6 +843,18 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
d2 = enddate.strftime("%Y-%m-%d"),
|
||||
)
|
||||
|
||||
p.xaxis.axis_label = 'Period'
|
||||
if yaxis == 'duration':
|
||||
p.yaxis.axis_label = 'Duration (min)'
|
||||
if totaldays>30: # pragma: no cover
|
||||
p.yaxis.axis_label = 'Duration (h)'
|
||||
elif yaxis == 'TRIMP':
|
||||
p.yaxis.axis_label = 'TRIMP'
|
||||
else: # pragma: no cover
|
||||
p.yaxis.axis_label = 'rScore'
|
||||
|
||||
|
||||
|
||||
p.plot_width=550
|
||||
p.plot_height=350
|
||||
p.toolbar_location = toolbar_location
|
||||
|
||||
@@ -319,7 +319,7 @@ rowtypes = (
|
||||
)
|
||||
|
||||
|
||||
checktypes = [i[0] for i in workouttypes]
|
||||
checktypes = [i[0] for i in workouttypes_ordered.items()]
|
||||
|
||||
from bokeh.palettes import Category10,Category20, Category20c
|
||||
|
||||
|
||||
@@ -3045,7 +3045,7 @@ def df_from_summary(data):
|
||||
|
||||
try:
|
||||
splits = data['workout']['splits']
|
||||
except KeyError:
|
||||
except KeyError: # pragma: no cover
|
||||
splits = [0]
|
||||
time = starttimeunix
|
||||
elapsed_distance = 0
|
||||
@@ -3053,7 +3053,7 @@ def df_from_summary(data):
|
||||
distances = [0]
|
||||
try:
|
||||
spms = [splits[0]['stroke_rate']]
|
||||
except KeyError:
|
||||
except KeyError: # pragma: no cover
|
||||
spms = [0]
|
||||
try:
|
||||
hrs = [splits[0]['heart_rate']['average']]
|
||||
|
||||
Reference in New Issue
Block a user