Created
March 21, 2023 19:12
-
-
Save ericksoa/92c18550c88a0d074e0702b3c54557ce to your computer and use it in GitHub Desktop.
Up and to the right, hurray!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/components/GrowthChart.tsx | |
| import React from 'react'; | |
| import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; | |
| interface GrowthData { | |
| month: string; | |
| revenue: number; | |
| } | |
| interface GrowthChartProps { | |
| data: GrowthData[]; | |
| } | |
| const GrowthChart: React.FC<GrowthChartProps> = ({ data }) => { | |
| return ( | |
| <ResponsiveContainer width="100%" height={400}> | |
| <LineChart | |
| data={data} | |
| margin={{ top: 20, right: 30, left: 20, bottom: 10 }} | |
| > | |
| <CartesianGrid strokeDasharray="3 3" /> | |
| <XAxis dataKey="month" /> | |
| <YAxis /> | |
| <Tooltip /> | |
| <Legend /> | |
| <Line | |
| type="monotone" | |
| dataKey="revenue" | |
| stroke="#8884d8" | |
| activeDot={{ r: 8 }} | |
| /> | |
| </LineChart> | |
| </ResponsiveContainer> | |
| ); | |
| }; | |
| export default GrowthChart; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment