import React, { useState } from 'react'; const BoxPlotAnatomyWidget: React.FC = () => { const [q1, setQ1] = useState(20); const [q3, setQ3] = useState(60); const [med, setMed] = useState(40); const min = 10; const max = 90; // Enforce constraints const handleMedChange = (val: number) => { setMed(Math.max(q1, Math.min(q3, val))); }; const handleQ1Change = (val: number) => { const newQ1 = Math.min(val, med); setQ1(Math.max(min, newQ1)); }; const handleQ3Change = (val: number) => { const newQ3 = Math.max(val, med); setQ3(Math.min(max, newQ3)); }; const scale = (val: number) => ((val) / 100) * 100; // 0-100 domain mapped to % return (
The middle 50% of data lies inside the box.