import React from "react"; import { XAxis, YAxis, Tooltip, ResponsiveContainer, AreaChart, Area, ReferenceLine, } from "recharts"; //types import { IIssue } from "types"; // helper import { getDatesInRange, renderShortNumericDateFormat } from "helpers/date-time.helper"; type Props = { issues: IIssue[]; start: string; end: string; }; const ProgressChart: React.FC = ({ issues, start, end }) => { const startDate = new Date(start); const endDate = new Date(end); const getChartData = () => { const dateRangeArray = getDatesInRange(startDate, endDate); let count = 0; const dateWiseData = dateRangeArray.map((d) => { const current = d.toISOString().split("T")[0]; const total = issues.length; const currentData = issues.filter( (i) => i.completed_at && i.completed_at.toString().split("T")[0] === current ); count = currentData ? currentData.length + count : count; return { currentDate: renderShortNumericDateFormat(current), currentDateData: currentData, pending: new Date(current) < new Date() ? total - count : null, }; }); return dateWiseData; }; const ChartData = getChartData(); return (
Ideal
Current
); }; export default ProgressChart;