Don't show exercises with few elements in graphs
This commit is contained in:
parent
4bc6b618f9
commit
325bb0cb72
1 changed files with 10 additions and 3 deletions
|
|
@ -219,18 +219,24 @@ def _linedata(mode, start, end):
|
|||
else:
|
||||
value = dist
|
||||
data[exer_type(dist, time, speed, date)].append([number, value])
|
||||
data = {
|
||||
key: value
|
||||
for key, value in data.items()
|
||||
if len(value) > 2
|
||||
}
|
||||
return data, lastday
|
||||
|
||||
|
||||
def lines(mode='distance', duration='thismonth'):
|
||||
plt.style.use('dark_background')
|
||||
fig = plt.figure(figsize=(12,6))
|
||||
fig = plt.figure(figsize=(18, 10))
|
||||
ax = fig.subplots()
|
||||
data, lastday = _linedata(mode,
|
||||
datetime.date.today().replace(day=1).replace(month=1),
|
||||
datetime.date.today() + datetime.timedelta(days=1),
|
||||
)
|
||||
for exer in TRACKED:
|
||||
if exer['describe'] in data:
|
||||
plt_line(data[exer['describe']], ax, exer['describe'], nbins=lastday)
|
||||
data, lastday = _linedata(mode,
|
||||
(datetime.date.today().replace(day=1).replace(month=1)
|
||||
|
|
@ -239,6 +245,7 @@ def lines(mode='distance', duration='thismonth'):
|
|||
- datetime.timedelta(days=1),
|
||||
)
|
||||
for exer in TRACKED:
|
||||
if exer['describe'] in data:
|
||||
plt_line(data[exer['describe']], ax, exer['describe'] + " (prev. year)", nbins=lastday)
|
||||
ax.legend(loc='upper left')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue