// 8-axis field — same look as the Master Equation calculator's orb. // Spokes radiating from center, four dashed reference rings (25/50/75/100), // per-axis colored dots, blurred glow polygon underneath the live shape. // Values are 0..100; the dot at value 100 lives on the outer ring. const AxisRadar = ({ values, ch }) => { const order = window.AXIS_ORDER || ['PO','NM','ER','SC','RS','ES','TA','PV']; const meta = window.AXIS_META || {}; const tintFor = (c) => (meta[c] && meta[c].tint) || '#3DDC97'; // Geometry — identical to the calculator orb's coordinate space. const CX = 120, CY = 120, R_MAX = 100, R_LABEL = 115; const angleFor = (i) => -Math.PI / 2 + (i * (Math.PI * 2 / 8)); const point = (i, ratio) => { const a = angleFor(i); const r = Math.max(0, Math.min(100, ratio)) / 100 * R_MAX; return [CX + Math.cos(a) * r, CY + Math.sin(a) * r]; }; // Live polygon points string. const ptStr = order.map((c, i) => { const v = values[i] != null ? values[i] : 0; const [x, y] = point(i, v); return `${x.toFixed(2)},${y.toFixed(2)}`; }).join(' '); // CH-bracket color drives the orb gradient + center text. const scoreColor = ( ch == null ? '#9AA7B5' : ch >= 76 ? '#117A4D' : ch >= 60 ? '#2F9E6B' : ch >= 40 ? '#B08D3C' : ch >= 20 ? '#B23A2E' : '#7A1F18' ); return (
{/* Dashed reference rings at 25 / 50 / 75 / 100 */} {[25, 50, 75, 100].map(r => ( ))} {/* Spokes */} {order.map((c, i) => { const [x, y] = point(i, 100); return ; })} {/* Blurred glow polygon underneath */} {/* Live shape polygon (filled radial gradient + stroked) */} {/* Axis dots, sized + tinted per-axis */} {order.map((c, i) => { const v = values[i] != null ? values[i] : 0; const [x, y] = point(i, v); const ratio = Math.max(0, Math.min(100, v)) / 100; const r = 3 + ratio * 3; return ( {c} · {(meta[c] && meta[c].name) || c} ); })} {/* Axis labels outside the outer ring */} {order.map((c, i) => { const a = angleFor(i); const tx = CX + Math.cos(a) * R_LABEL; const ty = CY + Math.sin(a) * R_LABEL; return ( {c} ); })} {/* Center CH score text */} {ch != null && ( {ch.toFixed(1)} CH )}
); }; window.AxisRadar = AxisRadar;