Skip to content

Commit d3f9652

Browse files
committed
feat(chart): The size of the chart now increases every 5 dates in the list
1 parent bc1e05f commit d3f9652

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

chart/function/create_chart.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ async def create_chart(
5555
return None
5656

5757
date, rate = [], []
58+
fig = plt.gcf()
5859

5960
for row in data:
6061
date.append(str(row['date']))
6162
rate.append(row['rate'])
63+
width = 18.5 + (len(date) // 5) * 2
64+
fig.set_size_inches(width, 9.5)
65+
6266

6367
if rate[0] < rate[-1]:
6468
plt.plot(date, rate, color='green', marker='o')
@@ -70,8 +74,6 @@ async def create_chart(
7074
plt.xlabel('Date')
7175
plt.ylabel('Rate')
7276

73-
fig = plt.gcf()
74-
fig.set_size_inches(18.5, 9.5)
7577

7678
name = await generate_unique_name(
7779
f'{from_currency.upper()}_{conv_currency.upper()}',

0 commit comments

Comments
 (0)