diff --git a/src/app/dashboard/page.js b/src/app/dashboard/page.js index 4935461..bc654c2 100644 --- a/src/app/dashboard/page.js +++ b/src/app/dashboard/page.js @@ -1,7 +1,7 @@ "use client"; import { useState, useEffect } from "react"; -import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; +import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, BarChart, Bar, ComposedChart } from 'recharts'; export default function TeamLeadsDashboard() { const [chartData, setChartData] = useState([]); @@ -38,14 +38,18 @@ export default function TeamLeadsDashboard() { const CustomTooltip = ({ active, payload, label }) => { if (active && payload && payload.length) { + // Find the monthly and cumulative values + const monthlyData = payload.find(p => p.dataKey === 'value'); + const cumulativeData = payload.find(p => p.dataKey === 'cumulative'); + return (
{`Month: ${label}`}
-- {`Monthly Value: ${formatCurrency(payload[0].value)}`} +
+ {`Monthly Value: ${monthlyData ? formatCurrency(monthlyData.value) : 'N/A'}`}
-- {`Cumulative: ${formatCurrency(payload[1].value)}`} +
+ {`Cumulative: ${cumulativeData ? formatCurrency(cumulativeData.value) : 'N/A'}`}