import Plot from "react-plotly.js"; import { useState } from "react"; interface ChartData { algorithm: string; compression_ratio: number; encode_speed: number; decode_speed: number; } interface BenchmarkChartsProps { chartData: ChartData[]; } export function BenchmarkCharts({ chartData }: BenchmarkChartsProps) { const [sortByRatio, setSortByRatio] = useState(true); if (!chartData.length) return null; const sortedData = sortByRatio ? [...chartData].sort((a, b) => a.compression_ratio - b.compression_ratio) : chartData; return (

Compression Ratio

d.algorithm), x: sortedData.map((d) => d.compression_ratio), marker: { color: "#8884d8" }, }, ]} layout={{ width: 800, // important not to specify height to allow it to be based on content margin: { t: 5, r: 30, l: 250, b: 30 }, xaxis: { title: "Ratio" }, dragmode: false, }} config={{ displayModeBar: false }} />

Encode Speed (MB/s)

d.algorithm), x: sortedData.map((d) => d.encode_speed), marker: { color: "#82ca9d" }, }, ]} layout={{ width: 800, // important not to specify height to allow it to be based on content margin: { t: 5, r: 30, l: 250, b: 30 }, xaxis: { title: "MB/s" }, }} config={{ displayModeBar: false }} />

Decode Speed (MB/s)

d.algorithm), x: sortedData.map((d) => d.decode_speed), marker: { color: "#ff7300" }, }, ]} layout={{ width: 800, // important not to specify height to allow it to be based on content margin: { t: 5, r: 30, l: 250, b: 30 }, xaxis: { title: "MB/s" }, }} config={{ displayModeBar: false }} />
); }