-
-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathchart.tsx
More file actions
171 lines (161 loc) · 6.25 KB
/
chart.tsx
File metadata and controls
171 lines (161 loc) · 6.25 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import React from 'react';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Cell, Legend, ResponsiveContainer, TooltipProps } from 'recharts';
const data = [
{ name: 'Community', team: 80 },
{ name: 'Courses', team: 78 },
{ name: 'Tutorials', team: 70 },
{ name: 'Problems', team: 67 },
{ name: 'Solutions', team: 65 }
];
const colors = [
'rgba(239,216,29,0.9)',
'rgba(49,105,148,0.9)',
'rgba(234,140,16,0.9)',
'rgba(42,1,100,0.9)',
'rgba(115,119,173,0.9)'
];
const CustomTooltip: React.FC<TooltipProps<number, string>> = ({ active, payload, label }) => {
if (active && payload && payload.length) {
return (
<div className="custom-tooltip bg-black p-2 rounded text-white">
<p className="label font-bold text-sm text-green-500">{label}</p>
</div>
);
}
return null;
};
const Community: React.FC = () => {
return (
<ResponsiveContainer width="100%" height={120}>
<BarChart
data={[{ name: 'Community', Community: 80 }]}
layout="vertical"
margin={{ top: 20, right: 5, left: 30, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<Tooltip contentStyle={{ backgroundColor: 'black', color: 'white' }} itemStyle={{ color: colors[0] }} />
<Legend />
<Bar dataKey="Community" fill="rgba(239,216,29,0.9)">
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[index]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
);
};
const Courses: React.FC = () => {
return (
<ResponsiveContainer width="100%" height={120}>
<BarChart
data={[{ name: 'Courses', Courses: 78 }]}
layout="vertical"
margin={{ top: 20, right: 5, left: 30, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<Tooltip contentStyle={{ backgroundColor: 'black', color: 'white' }} itemStyle={{ color: colors[1] }} />
<Legend />
<Bar dataKey="Courses" fill={colors[1]}>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[1]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
);
};
const Tutorials: React.FC = () => {
return (
<ResponsiveContainer width="100%" height={120}>
<BarChart
data={[{ name: 'Tutorials', Tutorials: 70 }]}
layout="vertical"
margin={{ top: 20, right: 5, left: 30, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<Tooltip contentStyle={{ backgroundColor: 'black', color: 'white' }} itemStyle={{ color: colors[2] }} />
<Legend />
<Bar dataKey="Tutorials" fill={colors[2]}>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[2]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
);
};
const Problems: React.FC = () => {
return (
<ResponsiveContainer width="100%" height={120}>
<BarChart
data={[{ name: 'Problems', Problems: 67 }]}
layout="vertical"
margin={{ top: 20, right: 5, left: 30, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<Tooltip contentStyle={{ backgroundColor: 'black', color: 'white' }} itemStyle={{ color: colors[3] }} />
<Legend />
<Bar dataKey="Problems" fill={colors[3]}>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[3]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
);
};
const Solutions: React.FC = () => {
return (
<ResponsiveContainer width="100%" height={120}>
<BarChart
data={[{ name: 'Solutions', Solutions: 65 }]}
layout="vertical"
margin={{ top: 20, right: 5, left: 30, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<Tooltip contentStyle={{ backgroundColor: 'black', color: 'white' }} itemStyle={{ color: colors[4] }} />
<Legend />
<Bar dataKey="Solutions" fill={colors[4]}>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[4]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
);
};
const Chart: React.FC = () => {
return (
<>
<h2 className="text-transparent mt-4">Join our Dynamic team to learn and succeed.</h2>
<ResponsiveContainer width="100%" height={400}>
<BarChart
data={data}
margin={{ top: 20, right: 30, left: 20, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis />
<Tooltip content={<CustomTooltip />} />
<Legend />
<Bar dataKey="team" fill="rgb(51, 212, 91)">
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[index]} />
))}
</Bar>
</BarChart>
</ResponsiveContainer>
</>
);
};
export { Chart, Community, Courses, Tutorials, Problems, Solutions };