import React from 'react'; import { useTheme } from '../../core/theme/ThemeProvider'; import { hexToRgba } from '../../core/color/utils'; interface ChartHeatmapProps { data: number[][]; // 2D array of values rowLabels: string[]; colLabels: string[]; className?: string; } export const ChartHeatmap: React.FC = ({ data, rowLabels, colLabels, className = '' }) => { const { theme } = useTheme(); if (!data.length || !data[0].length) return null; const numRows = data.length; const numCols = data[0].length; const maxValue = Math.max(...data.flat()); const color = theme.colors.primary; const cellWidth = 30; const cellHeight = 20; const rowLabelOffset = 40; const colLabelOffset = 20; const gridWidth = numCols * cellWidth; const gridHeight = numRows * cellHeight; const width = gridWidth + rowLabelOffset; const height = gridHeight + colLabelOffset; return (
{/* Column Labels */} {colLabels.map((label, i) => ( {label} ))} {/* Row Labels */} {rowLabels.map((label, i) => ( {label} ))} {/* Heatmap Cells */} {data.map((row, i) => row.map((value, j) => ( )) )}
); };