import { useState } from "react"; import { Pie } from "@visx/shape"; import { Group } from "@visx/group"; import { Text } from "@visx/text"; import { useColorModeValue } from "@chakra-ui/react"; const VisxPieChart = ({ data, title, width }) => { const [active, setActive] = useState(null); const half = width / 2; const textColor = useColorModeValue("gray.700", "white"); return ( data.percentage} outerRadius={half} innerRadius={({ data }) => { const size = active && active.name == data.name ? 12 : 8; return half - size; }} padAngle={0.01} > {(pie) => { return pie.arcs.map((arc) => { return ( setActive(arc.data)} onMouseLeave={() => setActive(null)} > ); }); }} <> {title} ); }; export default VisxPieChart;