mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 04:33:11 +03:00
fix(chart): Fixed currency rate and date indexes and other minor fixes
This commit is contained in:
parent
ef2c126d68
commit
e1fdda4b54
1 changed files with 7 additions and 6 deletions
|
@ -60,21 +60,20 @@ async def create_chart(
|
|||
date, rate = [], []
|
||||
|
||||
for row in data:
|
||||
parsed_date = datetime.strptime(row['data'], '%Y-%m-%d%H:%M:%S.%fZ').date()
|
||||
date.append(parsed_date)
|
||||
rate.append(row['rate'])
|
||||
date.append(row[0])
|
||||
rate.append(row[1])
|
||||
|
||||
spline = make_interp_spline(range(len(date)), rate, k=2)
|
||||
x = np.arange(len(date))
|
||||
|
||||
newx_2 = np.linspace(0, len(date) - 1, 200)
|
||||
newy_2 = spline_2(newx_2)
|
||||
fig, ax = plt.subplot(figsize=(15, 6))
|
||||
newy_2 = spline(newx_2)
|
||||
fig, ax = plt.subplots(figsize=(15, 6))
|
||||
|
||||
for label in (ax.get_xticklabels() + ax.get_yticklabels()):
|
||||
label.set_fontsize(10)
|
||||
|
||||
ax.set_xtick(np.linspace(0, len(date) - 1, 10))
|
||||
ax.set_xticks(np.linspace(0, len(date) - 1, 10))
|
||||
ax.set_xticklabels(
|
||||
[
|
||||
date[int(i)].strftime('%Y-%m-%d')
|
||||
|
@ -87,6 +86,8 @@ async def create_chart(
|
|||
datetime.now()
|
||||
)
|
||||
|
||||
|
||||
plt.plot(newx_2, newy_2)
|
||||
plt.savefig(f'../charts/{name}.png')
|
||||
fig.clear()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue