Skip to content

Commit

Permalink
feat: responsive container for application graph
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuan-zhou committed Nov 26, 2021
1 parent fcbad99 commit 78bd5f2
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/features/Stats/StatsApplicationsGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { IStatsApplications } from '../../config';

import {
ResponsiveContainer,
LineChart,
Line,
XAxis,
Expand All @@ -22,29 +23,29 @@ const StatsApplicationsGraph: React.FC<IStatsApplicationsGraph> = (props) => {

// cannot use ResponsiveContainer since parent has no width and height
return (
<LineChart
width={700}
height={300}
data={applications}
margin={{
top: 5,
right: 30,
left: 20,
bottom: 5
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" />
<YAxis />
<Tooltip />
<Legend />
<Line
type="monotone"
dataKey="applications"
stroke="#8884d8"
activeDot={{ r: 8 }}
/>
</LineChart>
<ResponsiveContainer width="100%" height={300}>
<LineChart
data={applications}
margin={{
top: 5,
right: 30,
left: 20,
bottom: 5
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" />
<YAxis />
<Tooltip />
<Legend />
<Line
type="monotone"
dataKey="applications"
stroke="#8884d8"
activeDot={{ r: 8 }}
/>
</LineChart>
</ResponsiveContainer>
);
}

Expand Down

0 comments on commit 78bd5f2

Please sign in to comment.