import Plot from 'react-plotly.js'; import type { ClusterViz } from '../../types'; const COLORS = [ '#58a6ff', '#3fb950', '#f0883e', '#bc8cff', '#39d2c0', '#f85149', '#d29922', '#79c0ff', '#56d364', '#ffa657', '#d2a8ff', '#a5d6ff', '#7ee787', '#ffd8b5', '#e2c5ff', '#76e3ea', '#ff7b72', '#e3b341', '#87ceeb', '#ff69b4', ]; interface Props { viz: ClusterViz; height?: number; } export function ClusterVisualization({ viz, height = 450 }: Props) { const traces = viz.traces.map((t, i) => ({ x: t.x, y: t.y, text: t.text, name: `${t.name} (${t.count})`, type: 'scatter' as const, mode: 'markers' as const, marker: { color: COLORS[i % COLORS.length], size: 5, opacity: 0.8, }, hoverinfo: 'text' as const, })); return ( ); }