fix: scope and demand line graph y axis values (#1563)

This commit is contained in:
Aaryan Khandelwal 2023-07-19 13:13:23 +05:30 committed by GitHub
parent 5e1f0a2604
commit c71a2137e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,12 +9,7 @@ type Props = {
defaultAnalytics: IDefaultAnalyticsResponse; defaultAnalytics: IDefaultAnalyticsResponse;
}; };
export const AnalyticsYearWiseIssues: React.FC<Props> = ({ defaultAnalytics }) => { export const AnalyticsYearWiseIssues: React.FC<Props> = ({ defaultAnalytics }) => (
const currentMonth = new Date().getMonth();
const startMonth = Math.floor(currentMonth / 3) * 3 + 1;
const quarterMonthsList = [startMonth, startMonth + 1, startMonth + 2];
return (
<div className="py-3 border border-custom-border-200 rounded-[10px]"> <div className="py-3 border border-custom-border-200 rounded-[10px]">
<h1 className="px-3 text-base font-medium">Issues closed in a year</h1> <h1 className="px-3 text-base font-medium">Issues closed in a year</h1>
{defaultAnalytics.issue_completed_month_wise.length > 0 ? ( {defaultAnalytics.issue_completed_month_wise.length > 0 ? (
@ -32,11 +27,9 @@ export const AnalyticsYearWiseIssues: React.FC<Props> = ({ defaultAnalytics }) =
})), })),
}, },
]} ]}
customYAxisTickValues={defaultAnalytics.issue_completed_month_wise.map((data) => { customYAxisTickValues={defaultAnalytics.issue_completed_month_wise.map(
if (quarterMonthsList.includes(data.month)) return data.count; (data) => data.count
)}
return 0;
})}
height="300px" height="300px"
colors={(datum) => datum.color} colors={(datum) => datum.color}
curve="monotoneX" curve="monotoneX"
@ -58,5 +51,4 @@ export const AnalyticsYearWiseIssues: React.FC<Props> = ({ defaultAnalytics }) =
<div className="text-custom-text-200 text-center text-sm py-8">No matching data found.</div> <div className="text-custom-text-200 text-center text-sm py-8">No matching data found.</div>
)} )}
</div> </div>
); );
};