File size: 3,874 Bytes
ffb4c35 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | import React from 'react';
import {
LineChart,
Line,
BarChart,
Bar,
PieChart,
Pie,
Cell,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
Legend,
ResponsiveContainer
} from 'recharts';
const COLORS = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899'];
export const TaskProgressChart = ({ data }) => {
return (
<ResponsiveContainer width="100%" height={300}>
<LineChart data={data}>
<CartesianGrid strokeDasharray="3 3" className="opacity-30" />
<XAxis dataKey="month" stroke="#6B7280" />
<YAxis stroke="#6B7280" />
<Tooltip
contentStyle={{
backgroundColor: '#1F2937',
border: '1px solid #374151',
borderRadius: '8px'
}}
/>
<Legend />
<Line
type="monotone"
dataKey="completed"
stroke="#10B981"
strokeWidth={2}
name="Completed"
/>
<Line
type="monotone"
dataKey="inProgress"
stroke="#3B82F6"
strokeWidth={2}
name="In Progress"
/>
<Line
type="monotone"
dataKey="pending"
stroke="#F59E0B"
strokeWidth={2}
name="Pending"
/>
</LineChart>
</ResponsiveContainer>
);
};
export const TaskDistributionChart = ({ data }) => {
return (
<ResponsiveContainer width="100%" height={300}>
<PieChart>
<Pie
data={data}
cx="50%"
cy="50%"
labelLine={false}
label={({ name, percent }) => `${name} ${(percent * 100).toFixed(0)}%`}
outerRadius={80}
fill="#8884d8"
dataKey="value"
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
))}
</Pie>
<Tooltip
contentStyle={{
backgroundColor: '#1F2937',
border: '1px solid #374151',
borderRadius: '8px'
}}
/>
</PieChart>
</ResponsiveContainer>
);
};
export const UserPerformanceChart = ({ data }) => {
return (
<ResponsiveContainer width="100%" height={300}>
<BarChart data={data}>
<CartesianGrid strokeDasharray="3 3" className="opacity-30" />
<XAxis dataKey="name" stroke="#6B7280" />
<YAxis stroke="#6B7280" />
<Tooltip
contentStyle={{
backgroundColor: '#1F2937',
border: '1px solid #374151',
borderRadius: '8px'
}}
/>
<Legend />
<Bar dataKey="tasks" fill="#3B82F6" name="Tasks Completed" />
<Bar dataKey="efficiency" fill="#10B981" name="Efficiency %" />
</BarChart>
</ResponsiveContainer>
);
};
export const ActivityChart = ({ data }) => {
return (
<ResponsiveContainer width="100%" height={300}>
<LineChart data={data}>
<CartesianGrid strokeDasharray="3 3" className="opacity-30" />
<XAxis dataKey="date" stroke="#6B7280" />
<YAxis stroke="#6B7280" />
<Tooltip
contentStyle={{
backgroundColor: '#1F2937',
border: '1px solid #374151',
borderRadius: '8px'
}}
/>
<Legend />
<Line
type="monotone"
dataKey="tasks"
stroke="#8B5CF6"
strokeWidth={2}
name="Tasks Created"
/>
<Line
type="monotone"
dataKey="comments"
stroke="#EC4899"
strokeWidth={2}
name="Comments"
/>
<Line
type="monotone"
dataKey="documents"
stroke="#F59E0B"
strokeWidth={2}
name="Documents Uploaded"
/>
</LineChart>
</ResponsiveContainer>
);
}; |