// 가벼운 SVG sparkline. lightweight-charts 인스턴스를 또 만들 필요 없음. // 종가 시계열을 받아 polyline 으로 그린다. 색상은 호출부에서 결정 (KR 관행: 상승=빨강, 하락=파랑). type Props = { values: number[]; stroke: string; width?: number; height?: number; className?: string; }; export function Sparkline({ values, stroke, width = 140, height = 44, className, }: Props) { if (values.length < 2) return null; const min = Math.min(...values); const max = Math.max(...values); const span = max - min || 1; const stepX = width / (values.length - 1); const points = values .map((v, i) => { const x = (i * stepX).toFixed(1); const y = (height - ((v - min) / span) * height).toFixed(1); return `${x},${y}`; }) .join(" "); return ( ); }