FECUOY's picture
Initial commit: HackingFactory v2 Enhanced with Self-Refining AI features
4c41b3d
import React from "react";
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
Filler
} from 'chart.js';
import { Line } from 'react-chartjs-2';
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
Filler
);
interface IterationChartProps {
data: { version: number; score: number }[];
}
export function IterationChart({ data }: IterationChartProps) {
const chartData = {
labels: data.map(d => `v${d.version}`),
datasets: [
{
label: 'Score Progress',
data: data.map(d => d.score),
borderColor: '#00d9ff',
backgroundColor: 'rgba(0, 217, 255, 0.1)',
fill: true,
tension: 0.4,
pointBackgroundColor: '#00ff41',
pointBorderColor: '#fff',
pointHoverRadius: 6,
},
],
};
const options = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false,
},
tooltip: {
backgroundColor: '#1a1a1a',
titleColor: '#00d9ff',
bodyColor: '#fff',
borderColor: '#00d9ff',
borderWidth: 1,
},
},
scales: {
y: {
min: 0,
max: 100,
grid: {
color: 'rgba(255, 255, 255, 0.1)',
},
ticks: {
color: '#888',
},
},
x: {
grid: {
display: false,
},
ticks: {
color: '#888',
},
},
},
};
return (
<div className="h-64 w-full">
<Line data={chartData} options={options} />
</div>
);
}