v1 activity_chart
This commit is contained in:
@@ -373,7 +373,7 @@ def interactive_workouttype_piechart(workouts):
|
||||
}
|
||||
|
||||
|
||||
script, div = get_chart("/workouttypepie", chart_data, debug=True)
|
||||
script, div = get_chart("/workouttypepie", chart_data, debug=False)
|
||||
|
||||
return script, div
|
||||
|
||||
@@ -567,6 +567,9 @@ def interactive_activitychart(workouts, startdate, enddate, stack='type', toolba
|
||||
|
||||
df.sort_values('date_sorting', inplace=True)
|
||||
|
||||
data_dict = df.to_dict("records")
|
||||
|
||||
|
||||
hv.extension('bokeh')
|
||||
|
||||
if stack == 'type':
|
||||
@@ -706,12 +709,9 @@ def interactive_activitychart2(workouts, startdate, enddate, stack='type', toolb
|
||||
while d <= enddate:
|
||||
dd = d.strftime('%d')
|
||||
|
||||
if totaldays <= 30:
|
||||
dates.append(d.strftime('%m/%d'))
|
||||
dates_sorting.append(d.strftime('%Y/%m/%d'))
|
||||
else:
|
||||
dates.append(d.strftime('%Y/%m'))
|
||||
dates_sorting.append(d.strftime('%Y/%m'))
|
||||
dates.append(d.strftime('%Y-%m-%d'))
|
||||
dates_sorting.append(d.strftime('%Y/%m/%d'))
|
||||
|
||||
durations.append(0)
|
||||
trimps.append(0)
|
||||
rscores.append(0)
|
||||
@@ -743,6 +743,41 @@ def interactive_activitychart2(workouts, startdate, enddate, stack='type', toolb
|
||||
|
||||
df = pd.DataFrame(thedict)
|
||||
|
||||
data_dict = df.to_dict("records")
|
||||
|
||||
if totaldays < 30:
|
||||
datebin = "day"
|
||||
elif totaldays < 50:
|
||||
datebin = "week"
|
||||
else:
|
||||
datebin = "month"
|
||||
|
||||
stacknames = {
|
||||
'TRIMP': 'trimp',
|
||||
'distance': 'distance',
|
||||
'time': 'duration',
|
||||
'rScore': 'rscore',
|
||||
'duration': 'duration',
|
||||
}
|
||||
|
||||
chart_data = {
|
||||
'data': data_dict,
|
||||
'title': 'Activity {d1} to {d2}'.format(
|
||||
d1=startdate.strftime("%Y-%m-%d"),
|
||||
d2=enddate.strftime("%Y-%m-%d"),
|
||||
),
|
||||
'datebin': datebin,
|
||||
'colorby': 'type',
|
||||
'stackby': stacknames[yaxis],
|
||||
'doreduce': True,
|
||||
'dosort': True,
|
||||
'colors': mytypes.color_map,
|
||||
}
|
||||
|
||||
script, div = get_chart("/activity_bar", chart_data, debug=True)
|
||||
|
||||
return script, div
|
||||
|
||||
if totaldays > 30 and yaxis == 'duration': # pragma: no cover
|
||||
df['duration'] = df['duration']/60
|
||||
elif yaxis == 'TRIMP':
|
||||
@@ -4739,7 +4774,6 @@ def get_zones_report(rower, startdate, enddate, trainingzones='hr', date_agg='we
|
||||
'hours': hours,
|
||||
}
|
||||
|
||||
# print(pd.DataFrame(data).head())
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -166,6 +166,8 @@
|
||||
$("#total_maxhr").append(totalsdict.hrmax);
|
||||
$("#total_power").append(totalsdict.powermean);
|
||||
$("#total_maxpower").append(totalsdict.powermax);
|
||||
$("#selectors").hide();
|
||||
|
||||
listofdicts.forEach(function(item){
|
||||
var id = "#"+item.id+"_hr";
|
||||
$(id).append(item.hrmean);
|
||||
|
||||
Reference in New Issue
Block a user