"use client"; import { motion } from "framer-motion"; import type { CDCTPoint } from "@/lib/types"; export function CompressionChart({ data }: { data: CDCTPoint[] }) { if (!data.length) return null; const w = 400, h = 180, pad = 30; const plotW = w - pad * 2, plotH = h - pad * 2; const points = data.map((d, i) => ({ x: pad + (i / Math.max(data.length - 1, 1)) * plotW, sa: pad + plotH - (d.sa_score / 10) * plotH, label: `${(d.compression_level * 100).toFixed(0)}%`, })); const linePath = points.map((p) => `${p.x},${p.sa}`).join(" "); return (
{/* Minimal Grid */} {[0, 5, 10].map((v) => { const y = pad + plotH - (v / 10) * plotH; return ( ); })} {/* Signal Line */} {/* Nodes */} {points.map((p, i) => ( ))} {/* X Labels */} {points.map((p, i) => ( {p.label} ))}
Semantic Integrity Curve
); }