Skip to content

Commit 78bd5f2

Browse files
committed
feat: responsive container for application graph
1 parent fcbad99 commit 78bd5f2

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

src/features/Stats/StatsApplicationsGraph.tsx

+24-23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import { IStatsApplications } from '../../config';
33

44
import {
5+
ResponsiveContainer,
56
LineChart,
67
Line,
78
XAxis,
@@ -22,29 +23,29 @@ const StatsApplicationsGraph: React.FC<IStatsApplicationsGraph> = (props) => {
2223

2324
// cannot use ResponsiveContainer since parent has no width and height
2425
return (
25-
<LineChart
26-
width={700}
27-
height={300}
28-
data={applications}
29-
margin={{
30-
top: 5,
31-
right: 30,
32-
left: 20,
33-
bottom: 5
34-
}}
35-
>
36-
<CartesianGrid strokeDasharray="3 3" />
37-
<XAxis dataKey="date" />
38-
<YAxis />
39-
<Tooltip />
40-
<Legend />
41-
<Line
42-
type="monotone"
43-
dataKey="applications"
44-
stroke="#8884d8"
45-
activeDot={{ r: 8 }}
46-
/>
47-
</LineChart>
26+
<ResponsiveContainer width="100%" height={300}>
27+
<LineChart
28+
data={applications}
29+
margin={{
30+
top: 5,
31+
right: 30,
32+
left: 20,
33+
bottom: 5
34+
}}
35+
>
36+
<CartesianGrid strokeDasharray="3 3" />
37+
<XAxis dataKey="date" />
38+
<YAxis />
39+
<Tooltip />
40+
<Legend />
41+
<Line
42+
type="monotone"
43+
dataKey="applications"
44+
stroke="#8884d8"
45+
activeDot={{ r: 8 }}
46+
/>
47+
</LineChart>
48+
</ResponsiveContainer>
4849
);
4950
}
5051

0 commit comments

Comments
 (0)