import { Bar, BarChart, CartesianGrid, XAxis, YAxis, LabelList } from "recharts"; import React, { useState, useEffect } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "~/components/ui/card"; import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "~/components/ui/chart"; export const description = "An interactive bar chart"; const chartData = [ { category: "کیمیا", ideas: 12, revenue: 850, cost: 320 }, { category: "ُفرآروزش", ideas: 19, revenue: 1200, cost: 450 }, { category: "خوارزمی", ideas: 15, revenue: 1400, cost: 520 }, ]; const chartConfig = { ideas: { label: "ایده‌ها", color: "#60A5FA", // Blue-400 }, revenue: { label: "درآمد (میلیون)", color: "#4ADE80", // Green-400 }, cost: { label: "کاهش هزینه (میلیون)", color: "#F87171", // Red-400 }, } satisfies ChartConfig; export function InteractiveBarChart() { const [activeChart, setActiveChart] = React.useState("ideas"); const total = React.useMemo( () => ({ ideas: chartData.reduce((acc, curr) => acc + curr.ideas, 0), revenue: chartData.reduce((acc, curr) => acc + curr.revenue, 0), cost: chartData.reduce((acc, curr) => acc + curr.cost, 0), }), [], ); return ( `${value}%`} /> ); }