Skip to content

Commit 42a8a24

Browse files
committed
adjusted margins and width of gender graph
1 parent 67092cc commit 42a8a24

File tree

7 files changed

+45
-20
lines changed

7 files changed

+45
-20
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@
4444
"last 1 firefox version",
4545
"last 1 safari version"
4646
]
47+
},
48+
"devDependencies": {
49+
"autoprefixer": "^10.4.20",
50+
"postcss": "^8.4.47",
51+
"tailwindcss": "^3.4.13"
4752
}
4853
}

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

src/Components/GenderChart.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const GenderChart = () => {
1010
const fetchData = async () => {
1111
try {
1212
const response = await axios.get(`${process.env.REACT_APP_API_URL}/data`);
13+
console.log(response.date);
1314
setData(response.data);
1415
} catch (error) {
1516
console.error('Error fetching data:', error);
@@ -31,20 +32,27 @@ const GenderChart = () => {
3132
}));
3233

3334
return (
34-
<div>
35-
<h2>Gender Distribution</h2>
36-
<ResponsiveContainer width="100%" height={400}>
37-
<BarChart data={chartData} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
35+
<div className="flex flex-col items-center justify-center h-screen bg-gray-100 p-6">
36+
<h2 className="text-3xl font-bold mb-6 text-gray-800">Gender Distribution</h2>
37+
<ResponsiveContainer width={500} height={600}>
38+
<BarChart data={chartData} margin={{ top: 20, right: 30, left: 20, bottom: 80 }}> {/* Increased bottom margin */}
3839
<CartesianGrid strokeDasharray="3 3" />
39-
<XAxis dataKey="gender" />
40+
<XAxis
41+
dataKey="gender"
42+
angle={-60} // Rotate labels
43+
textAnchor="end" // Adjust text anchor
44+
height={60} // Adjust height to allow for more space for the labels
45+
tickSize={30} // Increase tick size for better visibility
46+
interval={0} // Show all ticks
47+
/>
4048
<YAxis />
4149
<Tooltip />
4250
<Legend />
43-
<Bar dataKey="count" fill="#8884d8" />
51+
<Bar dataKey="count" fill="#4f46e5"/>
4452
</BarChart>
4553
</ResponsiveContainer>
4654
</div>
4755
);
4856
};
4957

50-
export default GenderChart;
58+
export default GenderChart;

src/index.css

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
body {
2-
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5-
sans-serif;
6-
-webkit-font-smoothing: antialiased;
7-
-moz-osx-font-smoothing: grayscale;
8-
}
9-
10-
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12-
monospace;
13-
}
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import { ChakraProvider } from '@chakra-ui/react';
6+
import './index.css';
67

78
const root = ReactDOM.createRoot(document.getElementById('root'));
89
root.render(

tailwind.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
"./src/**/*.{js,jsx,ts,tsx}",
5+
],
6+
theme: {
7+
extend: {},
8+
},
9+
plugins: [],
10+
}

0 commit comments

Comments
 (0)