From c71a2137e64b33df6b02613e587c75f88c3c79b6 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:13:23 +0530 Subject: [PATCH] fix: scope and demand line graph y axis values (#1563) --- .../scope-and-demand/year-wise-issues.tsx | 94 +++++++++---------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/apps/app/components/analytics/scope-and-demand/year-wise-issues.tsx b/apps/app/components/analytics/scope-and-demand/year-wise-issues.tsx index 4510b6738..621706f0e 100644 --- a/apps/app/components/analytics/scope-and-demand/year-wise-issues.tsx +++ b/apps/app/components/analytics/scope-and-demand/year-wise-issues.tsx @@ -9,54 +9,46 @@ type Props = { defaultAnalytics: IDefaultAnalyticsResponse; }; -export const AnalyticsYearWiseIssues: React.FC = ({ defaultAnalytics }) => { - const currentMonth = new Date().getMonth(); - const startMonth = Math.floor(currentMonth / 3) * 3 + 1; - const quarterMonthsList = [startMonth, startMonth + 1, startMonth + 2]; - - return ( -
-

Issues closed in a year

- {defaultAnalytics.issue_completed_month_wise.length > 0 ? ( - ({ - x: month.label.substring(0, 3), - y: - defaultAnalytics.issue_completed_month_wise.find( - (data) => data.month === month.value - )?.count || 0, - })), - }, - ]} - customYAxisTickValues={defaultAnalytics.issue_completed_month_wise.map((data) => { - if (quarterMonthsList.includes(data.month)) return data.count; - - return 0; - })} - height="300px" - colors={(datum) => datum.color} - curve="monotoneX" - margin={{ top: 20 }} - enableSlices="x" - sliceTooltip={(datum) => ( -
- {datum.slice.points[0].data.yFormatted} - issues closed in - {datum.slice.points[0].data.xFormatted} -
- )} - theme={{ - background: "rgb(var(--color-background-100))", - }} - enableArea - /> - ) : ( -
No matching data found.
- )} -
- ); -}; +export const AnalyticsYearWiseIssues: React.FC = ({ defaultAnalytics }) => ( +
+

Issues closed in a year

+ {defaultAnalytics.issue_completed_month_wise.length > 0 ? ( + ({ + x: month.label.substring(0, 3), + y: + defaultAnalytics.issue_completed_month_wise.find( + (data) => data.month === month.value + )?.count || 0, + })), + }, + ]} + customYAxisTickValues={defaultAnalytics.issue_completed_month_wise.map( + (data) => data.count + )} + height="300px" + colors={(datum) => datum.color} + curve="monotoneX" + margin={{ top: 20 }} + enableSlices="x" + sliceTooltip={(datum) => ( +
+ {datum.slice.points[0].data.yFormatted} + issues closed in + {datum.slice.points[0].data.xFormatted} +
+ )} + theme={{ + background: "rgb(var(--color-background-100))", + }} + enableArea + /> + ) : ( +
No matching data found.
+ )} +
+);