Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sourabhbagrecha/227a5d2f25e3be943dd01b1f6e0df1fb to your computer and use it in GitHub Desktop.
Save sourabhbagrecha/227a5d2f25e3be943dd01b1f6e0df1fb to your computer and use it in GitHub Desktop.
import Chart from "react-google-charts";
const CategoryAnalytics = ({ data }) => {
const chartData = [["Category", "Amount"]];
data.forEach(({ category, amount }) => {
chartData.push([category, amount]);
});
return <>
<h3>Category Analytics</h3>
<Chart
chartType="PieChart"
data={chartData}
width={"100%"}
height={"400px"}
/>
</>
}
export default CategoryAnalytics;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment