import { useMemo, ReactNode } from "react" // @mui material components import Card from "@mui/material/Card" import Icon from "@mui/material/Icon" // ThreeD Garden components import MDBox from "~/components/mui/MDBox" import MDTypography from "~/components/mui/MDTypography" import MDProgress from "~/components/mui/MDProgress" // ProgressLineChart configurations import configs from "~/components/elements/Charts/LineCharts/ProgressLineChart/config" // react-chartjs-2 components import { Line } from "react-chartjs-2" import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend } from "chart.js" ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend ) // Declaring props types for GradientLineChart interface Props { color?: | "primary" | "secondary" | "info" | "success" | "warning" | "error" | "dark" icon: ReactNode title: string count?: string | number progress: number height?: string | number chart: { labels: string[] data: number[] } [key: string]: any } function ProgressLineChart({ color, icon, title, count, progress, height, chart, }: Props): JSX.Element { const { data, options } = configs( color, chart.labels || [], title, chart.data || [] ) return ( {icon} {title} {count ? ( {count} ) : null} {progress}% {useMemo( () => ( {/* options={options} */} ), [chart, height, color] )} ) } // Declaring default props for ProgressLineChart ProgressLineChart.defaultProps = { color: "info", count: 0, height: "6.25rem", } export default ProgressLineChart