I'm using barchart in recharts
const data = [
{ name: 'Page A', uv: 4000, pv: 2400, color:'yellow', amt: 2400 },
];
const SimpleBarChart = (data) => ({
return (
<BarChart
width={600}
height={300} data={data}
margin={{ top: 5, right: 30, left: 20, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3"/>
<XAxis dataKey="name"/>
<YAxis/>
<Legend />
<Bar dataKey="pv" fill={data.color} />
</BarChart>
);
})
I want to use color from the json. What should be the syntax of fill in the code ?