diff --git a/CHANGELOG.md b/CHANGELOG.md index 1af0c53..6caa765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## Unrelease -* Add React * Make it possible to edit sessions (https://git.kucharczyk.xyz/lukas/timetracker/issues/46) +* Show markers on smaller graphs to make it clearer which dates the session belong to ## 1.0.0 / 2023-01-20 19:54+01:00 diff --git a/common/plots.py b/common/plots.py index 47e5f9c..6777443 100644 --- a/common/plots.py +++ b/common/plots.py @@ -64,7 +64,7 @@ def get_chart(data, title="", xlabel="", ylabel=""): plt.switch_backend("SVG") fig, ax = plt.subplots() fig.set_size_inches(10, 4) - ax.plot(x, y) + lines = ax.plot(x, y, "-o") first = x[0] last = x[-1] difference = last - first @@ -76,7 +76,11 @@ def get_chart(data, title="", xlabel="", ylabel=""): elif difference.days < 720: ax.xaxis.set_major_locator(mdates.MonthLocator()) ax.xaxis.set_minor_locator(mdates.WeekdayLocator()) + for line in lines: + line.set_marker("") else: + for line in lines: + line.set_marker("") ax.xaxis.set_major_locator(mdates.YearLocator()) ax.xaxis.set_minor_locator(mdates.MonthLocator())