import Plot from "react-plotly.js"; import type { Data } from "plotly.js"; import type { Trajectory } from "./useOptimisation"; // f at each iteration, one line per run export default function HistoryPlot({ trajectories }: { trajectories: Trajectory[] }) { const data = trajectories.map((t) => ({ x: t.path.map((_, k) => k), y: t.path.map((p) => p.value), type: "scatter", mode: "lines+markers", name: t.label, line: { color: t.color, width: 2 }, marker: { color: t.color, size: 4 }, hovertemplate: "iteration %{x}
f = %{y:.4g}", })) as Data[]; return (
f at each iteration
); }