import React from "react"; const CircularDiagram = ({ segments }) => { const radius = 70; // Radius of the circle const strokeWidth = 20; // Width of each portion const circumference = 2 * Math.PI * (radius - strokeWidth / 2); let startOffset = -63; // Initial offset for each segment const svgStyles = { display: "block", margin: "0 auto", }; console.log(segments) return ( {segments.map((segment, index) => { const { percentage, color } = segment; console.log(percentage) let p = percentage; if(p == 'Infinity' || isNaN(p)) p = 0; const segmentLength = (circumference * p) / 100; const strokeDashoffset = circumference - startOffset; startOffset += segmentLength; return ( ); })} ); }; export default CircularDiagram;