diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 99ca8996..35fd6fac 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -3972,8 +3972,18 @@ def interactive_cum_flex_chart2(theworkouts, promember=0, # datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2) ids = [int(w.id) for w in theworkouts] - columns = [xparam, yparam1, yparam2, 'spm', 'driveenergy', 'distance'] - datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, + #columns = [xparam, yparam1, yparam2, 'spm', 'driveenergy', 'distance'] + columns = [name for name, d in metrics.rowingmetrics] + columns_basic = [name for name, d in metrics.rowingmetrics if d['group'] == 'basic'] + columns = columns + ['spm', 'driveenergy', 'distance'] + columns_basic = columns_basic + ['spm', 'driveenergy', 'distance'] + + datadf = pd.DataFrame() + if promember: + datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, + workstrokesonly=workstrokesonly) + else: + datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, workstrokesonly=workstrokesonly) try: @@ -4066,28 +4076,17 @@ def interactive_cum_flex_chart2(theworkouts, promember=0, ytrend = func(x1, popt[0], popt[1]) datadf['ytrend'] = ytrend + data_dict = datadf.to_dict("records") + + metrics_list = [{'name': name, 'rowingmetrics':d } for name, d in metrics.rowingmetrics] + chart_data = { 'title': 'Some Chart', - 'data': [ - { - 'ftime': '03:00.0', - 'workout': 'a', - 'spm': 24, - 'distance':1000 - }, - { - 'ftime': '03:00.0', - 'workout': 'a', - 'spm': 24, - 'distance':1000 - }, - { - 'ftime': '03:00.0', - 'workout': 'a', - 'spm': 24, - 'distance':1000 - }, - ] + 'x': xparam, + 'y1': yparam1, + 'y2': yparam2, + 'data': data_dict, + 'metrics': metrics_list, } script, div = get_chart("/dots", chart_data) diff --git a/rowers/metrics.py b/rowers/metrics.py index 285529b3..3766addb 100644 --- a/rowers/metrics.py +++ b/rowers/metrics.py @@ -364,6 +364,7 @@ for key, dict in rowingmetrics: metricsdicts[key] = dict + metricsgroups = list(set([d['group'] for n, d in rowingmetrics])) dtypes = {}