-
Notifications
You must be signed in to change notification settings - Fork 0
/
gender_bar_chart.js
49 lines (45 loc) · 1012 Bytes
/
gender_bar_chart.js
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
/**
*
*/
import React, { Component } from 'react';
import {
BarChart,
Bar,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
} from 'recharts';
export default class GenderBarChart extends Component {
constructor(props) {
super(props);
this.state = {
data: [
{ gender: 'woman', count: 50, },
{ gender: 'man', count: 15, },
{ gender: 'other', count: 3, },
{ gender: 'unspecified', count: 0, },
]
};
}
render() {
const { data } = this.state;
return (
<div>
<div>
<h3>Report Trend - Gender</h3>
</div>
<ResponsiveContainer width="100%" height={400}>
<BarChart data={data} margin={{top: 5, right: 30, left: 20, bottom: 5}}>
<Tooltip />
<CartesianGrid />
<XAxis dataKey='gender' />
<YAxis/>
<Bar dataKey='count' fill='#F85032' />
</BarChart>
</ResponsiveContainer>
</div>
);
}
}