import Plot from 'react-plotly.js'; import type { CramersVData } from '../../types'; interface Props { data: CramersVData; height?: number; } export function CorrelationHeatmap({ data, height = 400 }: Props) { // Mask upper triangle const masked = data.matrix.map((row, i) => row.map((val, j) => (j > i ? null : val)) ); // Annotation text const annotations = []; for (let i = 0; i < data.labels.length; i++) { for (let j = 0; j <= i; j++) { annotations.push({ x: data.labels[j], y: data.labels[i], text: masked[i][j] != null ? masked[i][j]!.toFixed(2) : '', font: { color: '#e6edf3', size: 10 }, showarrow: false, }); } } return ( ); }