26 lines
694 B
Python
26 lines
694 B
Python
import matplotlib.pyplot as plt
|
|
import json
|
|
from datetime import datetime
|
|
|
|
today = datetime.today().strftime("%Y%m%d")
|
|
msgs = [] # Y
|
|
days = [] # X
|
|
|
|
for i in range(1,8):
|
|
day = str(int(today) - i)
|
|
days.append(str(f"{day[6:8]}.{day[4:6]}")) # format daty d.m
|
|
with open(f"/opt/bots/stats/stats.json{day}") as f:
|
|
data = json.loads(f.read())
|
|
msgs.append(data['today_msg'])
|
|
|
|
days.reverse() # bylo od tylu
|
|
msgs.reverse()
|
|
|
|
plt.plot(days, msgs, color="#dd9a1a")
|
|
plt.title("Wiadomosci IRC na tylda.org", color="white")
|
|
plt.ylabel("Liczba wiadomosci", color="white")
|
|
plt.xlabel("Dzien", color="white")
|
|
plt.tick_params(colors="white")
|
|
|
|
plt.savefig("stats.png", transparent=True)
|