From d3f9652d8a7e70f7b862660bd648c54da04556bb Mon Sep 17 00:00:00 2001 From: Redume Date: Sun, 5 Jan 2025 00:34:44 +0300 Subject: [PATCH] feat(chart): The size of the chart now increases every 5 dates in the list --- chart/function/create_chart.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chart/function/create_chart.py b/chart/function/create_chart.py index bcafb81..f6b1d07 100644 --- a/chart/function/create_chart.py +++ b/chart/function/create_chart.py @@ -55,10 +55,14 @@ async def create_chart( return None date, rate = [], [] + fig = plt.gcf() for row in data: date.append(str(row['date'])) rate.append(row['rate']) + width = 18.5 + (len(date) // 5) * 2 + fig.set_size_inches(width, 9.5) + if rate[0] < rate[-1]: plt.plot(date, rate, color='green', marker='o') @@ -70,8 +74,6 @@ async def create_chart( plt.xlabel('Date') plt.ylabel('Rate') - fig = plt.gcf() - fig.set_size_inches(18.5, 9.5) name = await generate_unique_name( f'{from_currency.upper()}_{conv_currency.upper()}',