Created
February 10, 2023 16:56
-
-
Save solomon-fibonacci/8f78fa81480eff62f54c3187652d2156 to your computer and use it in GitHub Desktop.
Recharts Example:
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
import { BarChart, Bar, XAxis, YAxis, Tooltip, Legend } from 'recharts'; | |
const data = [ | |
{ name: 'Jan', apples: 400, bananas: 300 }, | |
{ name: 'Feb', apples: 500, bananas: 350 }, | |
{ name: 'Mar', apples: 600, bananas: 400 }, | |
{ name: 'Apr', apples: 700, bananas: 450 }, | |
]; | |
const App = () => ( | |
<BarChart | |
width={800} | |
height={400} | |
data={data} | |
margin={{ top: 20, right: 30, left: 20, bottom: 5 }} | |
> | |
<XAxis dataKey="name" /> | |
<YAxis /> | |
<Tooltip /> | |
<Legend /> | |
<Bar dataKey="apples" fill="#8884d8" /> | |
<Bar dataKey="bananas" fill="#82ca9d" /> | |
</BarChart> | |
); | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment