diff --git a/src/app/dashboard/_PageSections/charts/Bar.tsx b/src/app/dashboard/_PageSections/charts/Bar.tsx index a18c00b..24f9cef 100644 --- a/src/app/dashboard/_PageSections/charts/Bar.tsx +++ b/src/app/dashboard/_PageSections/charts/Bar.tsx @@ -1,7 +1,6 @@ 'use client'; - -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/Card'; -import React from 'react'; +import React, { useState } from 'react'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { BarChart, Bar, @@ -10,132 +9,178 @@ import { CartesianGrid, Tooltip, Legend, - ResponsiveContainer + ResponsiveContainer, + LabelList } from 'recharts'; const data = [ - { - date: '2000-01', - uv: 4000, - pv: 2400, - amt: 2400 - }, - { - date: '2000-02', - uv: 3000, - pv: 1398, - amt: 2210 - }, - { - date: '2000-03', - uv: 2000, - pv: 9800, - amt: 2290 - }, - { - date: '2000-04', - uv: 2780, - pv: 3908, - amt: 2000 - }, - { - date: '2000-05', - uv: 1890, - pv: 4800, - amt: 2181 - }, - { - date: '2000-06', - uv: 2390, - pv: 3800, - amt: 2500 - }, - { - date: '2000-07', - uv: 3490, - pv: 4300, - amt: 2100 - }, - { - date: '2000-08', - uv: 4000, - pv: 2400, - amt: 2400 - }, - { - date: '2000-09', - uv: 3000, - pv: 1398, - amt: 2210 - }, - { - date: '2000-10', - uv: 2000, - pv: 9800, - amt: 2290 - }, - { - date: '2000-11', - uv: 2780, - pv: 3908, - amt: 2000 - }, - { - date: '2000-12', - uv: 1890, - pv: 4800, - amt: 2181 - } + { date: '2000-01', uv: 4000, pv: 2400, amt: 2400 }, + { date: '2000-02', uv: 3000, pv: 1398, amt: 2210 }, + { date: '2000-03', uv: 2000, pv: 9800, amt: 2290 }, + { date: '2000-04', uv: 2780, pv: 3908, amt: 2000 }, + { date: '2000-05', uv: 1890, pv: 4800, amt: 2181 }, + { date: '2000-06', uv: 2390, pv: 3800, amt: 2500 }, + { date: '2000-07', uv: 3490, pv: 4300, amt: 2100 }, + { date: '2000-08', uv: 4000, pv: 2400, amt: 2400 }, + { date: '2000-09', uv: 3000, pv: 1398, amt: 2210 }, + { date: '2000-10', uv: 2000, pv: 9800, amt: 2290 }, + { date: '2000-11', uv: 2780, pv: 3908, amt: 2000 }, + { date: '2000-12', uv: 1890, pv: 4800, amt: 2181 } ]; -const monthTickFormatter = (tick) => { - let date = new Date(tick); - let dateTick = date.getMonth() + 1; +// Enhanced data with quarter information +const enhancedData = data.map(item => { + const date = new Date(item.date); + const month = date.getMonth(); + const quarter = Math.floor(month / 3) + 1; + return { + ...item, + quarter: `Q${quarter}`, + formattedMonth: new Date(item.date).toLocaleString('default', { month: 'short' }) + }; +}); + +// Custom tooltip component +const CustomTooltip = ({ active, payload, label }) => { + if (active && payload && payload.length) { + const date = new Date(label); + const monthName = date.toLocaleString('default', { month: 'long' }); + const year = date.getFullYear(); + + return ( +
{`${monthName} ${year}`}
+ {payload.map((entry, index) => ( +{`${entry.name}: ${entry.value.toLocaleString()}`}
+