Show markers on smaller graphs
This commit is contained in:
parent
c1b1cda38e
commit
8918df1dfd
|
@ -1,7 +1,7 @@
|
||||||
## Unrelease
|
## Unrelease
|
||||||
|
|
||||||
* Add React
|
|
||||||
* Make it possible to edit sessions (https://git.kucharczyk.xyz/lukas/timetracker/issues/46)
|
* 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
|
## 1.0.0 / 2023-01-20 19:54+01:00
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ def get_chart(data, title="", xlabel="", ylabel=""):
|
||||||
plt.switch_backend("SVG")
|
plt.switch_backend("SVG")
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
fig.set_size_inches(10, 4)
|
fig.set_size_inches(10, 4)
|
||||||
ax.plot(x, y)
|
lines = ax.plot(x, y, "-o")
|
||||||
first = x[0]
|
first = x[0]
|
||||||
last = x[-1]
|
last = x[-1]
|
||||||
difference = last - first
|
difference = last - first
|
||||||
|
@ -76,7 +76,11 @@ def get_chart(data, title="", xlabel="", ylabel=""):
|
||||||
elif difference.days < 720:
|
elif difference.days < 720:
|
||||||
ax.xaxis.set_major_locator(mdates.MonthLocator())
|
ax.xaxis.set_major_locator(mdates.MonthLocator())
|
||||||
ax.xaxis.set_minor_locator(mdates.WeekdayLocator())
|
ax.xaxis.set_minor_locator(mdates.WeekdayLocator())
|
||||||
|
for line in lines:
|
||||||
|
line.set_marker("")
|
||||||
else:
|
else:
|
||||||
|
for line in lines:
|
||||||
|
line.set_marker("")
|
||||||
ax.xaxis.set_major_locator(mdates.YearLocator())
|
ax.xaxis.set_major_locator(mdates.YearLocator())
|
||||||
ax.xaxis.set_minor_locator(mdates.MonthLocator())
|
ax.xaxis.set_minor_locator(mdates.MonthLocator())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue