import { useEffect, useRef } from "react"; import Chart from "react-apexcharts"; import { ApexOptions } from "apexcharts"; import flatpickr from "flatpickr"; import ChartTab from "../common/ChartTab"; import { CalenderIcon } from "../../icons"; export default function StatisticsChart() { const datePickerRef = useRef(null); useEffect(() => { if (!datePickerRef.current) return; const today = new Date(); const sevenDaysAgo = new Date(); sevenDaysAgo.setDate(today.getDate() - 6); const fp = flatpickr(datePickerRef.current, { mode: "range", static: true, monthSelectorType: "static", dateFormat: "M d", defaultDate: [sevenDaysAgo, today], clickOpens: true, prevArrow: '', nextArrow: '', }); return () => { if (!Array.isArray(fp)) { fp.destroy(); } }; }, []); const options: ApexOptions = { legend: { show: false, // Hide legend position: "top", horizontalAlign: "left", }, colors: ["#465FFF", "#9CB9FF"], // Define line colors chart: { fontFamily: "Outfit, sans-serif", height: 310, type: "line", // Set the chart type to 'line' toolbar: { show: false, // Hide chart toolbar }, }, stroke: { curve: "straight", // Define the line style (straight, smooth, or step) width: [2, 2], // Line width for each dataset }, fill: { type: "gradient", gradient: { opacityFrom: 0.55, opacityTo: 0, }, }, markers: { size: 0, // Size of the marker points strokeColors: "#fff", // Marker border color strokeWidth: 2, hover: { size: 6, // Marker size on hover }, }, grid: { xaxis: { lines: { show: false, // Hide grid lines on x-axis }, }, yaxis: { lines: { show: true, // Show grid lines on y-axis }, }, }, dataLabels: { enabled: false, // Disable data labels }, tooltip: { enabled: true, // Enable tooltip x: { format: "dd MMM yyyy", // Format for x-axis tooltip }, }, xaxis: { type: "category", // Category-based x-axis categories: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ], axisBorder: { show: false, // Hide x-axis border }, axisTicks: { show: false, // Hide x-axis ticks }, tooltip: { enabled: false, // Disable tooltip for x-axis points }, }, yaxis: { labels: { style: { fontSize: "12px", // Adjust font size for y-axis labels colors: ["#6B7280"], // Color of the labels }, }, title: { text: "", // Remove y-axis title style: { fontSize: "0px", }, }, }, }; const series = [ { name: "Sales", data: [180, 190, 170, 160, 175, 165, 170, 205, 230, 210, 240, 235], }, { name: "Revenue", data: [40, 30, 50, 40, 55, 40, 70, 100, 110, 120, 150, 140], }, ]; return (

Statistics

Target you've set for each month

); }