"use client"; import { Chart as ChartJS, CategoryScale, LinearScale, LineElement, Title, Tooltip, Legend, PointElement, } from "chart.js"; import { colors } from "@/lib/colors"; import { useTheme } from "next-themes"; import { hexToRGB } from "@/lib/utils"; import { Line } from "react-chartjs-2"; import { faker } from "@faker-js/faker"; ChartJS.register( CategoryScale, LinearScale, LineElement, Title, Tooltip, Legend, PointElement ); const DropChart = ({ height = 350 }) => { const { theme: mode } = useTheme(); const labels = [ "January", "February", "March", "April", "May", "June", "July", ]; const data: any = { labels: labels, datasets: [ { label: "Dataset 1", animations: { y: { duration: 2000, delay: 500, }, }, data: labels.map(() => faker.number.int({ min: -100, max: 100 })), borderColor: hexToRGB(colors.danger, 0.5), backgroundColor: hexToRGB(colors.danger, 0.5), fill: true, tension: 0.5, }, { label: "Dataset 1", data: labels.map(() => faker.number.int({ min: -100, max: 100 })), borderColor: hexToRGB(colors.info, 0.5), backgroundColor: hexToRGB(colors.info, 0.5), }, ], }; const options: any = { responsive: true, plugins: { legend: { labels: { color: mode === 'light' ? colors["default-600"] : colors["default-300"], }, display: true, } }, animation: { y: { easing: "easeInOutElastic", from: (ctx: any) => { if (ctx.type === "data") { if (ctx.mode === "default" && !ctx.dropped) { ctx.dropped = true; return 0; } } }, }, }, hover: { mode: "index", intersect: false, }, scales: { y: { stacked: true, grid: { drawTicks: false, display: false, }, ticks: { color: mode === 'light' ? colors["default-600"] : colors["default-300"], }, }, x: { stacked: true, title: { color: mode === 'light' ? colors["default-600"] : colors["default-300"], display: true, }, grid: { drawTicks: false, display: false, }, ticks: { color: mode === 'light' ? colors["default-600"] : colors["default-300"], } } }, maintainAspectRatio: false, }; return (