Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

The docs charts were rendering mock data; they now load and transform real benchmark JSON for convergence, ECDF, and distribution visuals.

  • Data plumbing

    • Added benchmarkTransforms.ts to convert benchmark JSON runs into convergence, ECDF, and violin series.
    • Published demo benchmark JSON under docs/public/benchmarks for live chart consumption.
  • Chart consumption

    • Updated benchmark-demo.md and test-charts.md to fetch benchmark data on mount, handle loading/error states, and derive series via the new utilities.
    • Registered Vue-ECharts and custom chart components directly in the VitePress theme.
  • Pipeline alignment

    • Swapped plot generation to read history.best_fitness for convergence lines.

Example:

const convergenceData = buildConvergenceSeries(
  dataset.value,
  'shifted_ackley',
  2,
  optimizers.value
)

const ecdfData = buildECDFSeries(
  dataset.value,
  'shifted_ackley',
  2,
  [1e-1, 1e-3, 1e-5, 1e-7],
  optimizers.value
)
Original prompt

This section details on the original issue you should resolve

<issue_title>Chart Components: Wire ECharts to Real Benchmark Data</issue_title>
<issue_description>## Problem
PR #120 added ECharts Vue components (ECDF, Convergence, Violin, 3D Landscape), but they currently use mock/placeholder data. The charts need to consume real benchmark results from the data pipeline.

Context

Current State

After PR #120:

docs/.vitepress/components/
├── ConvergenceChart.vue    # Uses mock convergence data
├── ECDFChart.vue           # Uses mock ECDF data  
├── ViolinPlot.vue          # Uses mock distribution data
└── FitnessLandscape3D.vue  # Uses mock 3D surface data

Gap Analysis

What Exists

What's Missing

  1. Data Format Bridge - Benchmark JSON → ECharts option format
  2. Real Benchmark Data - CI-generated results in docs/public/benchmarks/
  3. Dynamic Data Loading - Fetch benchmark results per algorithm
  4. ECDF Calculation - Empirical CDF from multi-run results

Implementation

1. Benchmark Data Format

Expected structure in docs/public/benchmarks/:

{
  "algorithm": "ParticleSwarm",
  "function": "shifted_ackley",
  "dim": 10,
  "runs": [
    {
      "seed": 0,
      "best_fitness": 0.0012,
      "convergence_history": [100, 50, 10, 1, 0.1, 0.01, 0.001],
      "evaluations": 10000
    }
  ]
}

2. Data Transformer

Create docs/.vitepress/utils/benchmarkToECharts.ts:

export function toConvergenceOption(runs: BenchmarkRun[]): EChartsOption {
  return {
    xAxis: { type: 'value', name: 'Iteration' },
    yAxis: { type: 'log', name: 'Best Fitness' },
    series: runs.map((run, i) => ({
      type: 'line',
      data: run.convergence_history.map((v, i) => [i, v]),
      name: `Run ${i + 1}`
    }))
  }
}

export function toECDFOption(runs: BenchmarkRun[], targets: number[]): EChartsOption {
  // Calculate empirical CDF at each target threshold
}

3. Component Enhancement

Update ConvergenceChart.vue:

<script setup lang="ts">
import { toConvergenceOption } from '../utils/benchmarkToECharts'

const props = defineProps<{
  algorithm: string
  function: string
}>()

const benchmarkData = await useFetch(
  `/benchmarks/${props.algorithm}_${props.function}.json`
)
const option = computed(() => toConvergenceOption(benchmarkData.value.runs))
</script>

4. Algorithm Page Integration

Each algorithm markdown page:

## Benchmark Results

<ConvergenceChart algorithm="ParticleSwarm" function="shifted_ackley" />
<ECDFChart algorithm="ParticleSwarm" :targets="[1e-1, 1e-3, 1e-5, 1e-7]" />

Acceptance Criteria

  • Benchmark JSON files exist in docs/public/benchmarks/
  • toConvergenceOption() transforms run data correctly
  • toECDFOption() calculates empirical CDF
  • ConvergenceChart renders real multi-run data
  • ECDFChart shows proper performance profiles
  • ViolinPlot displays fitness distribution
  • 3D Landscape uses actual function evaluations
  • No mock data remains in production build

Validation

# Ensure benchmark data exists
ls docs/public/benchmarks/*.json | wc -l  # Should be > 0

# Test chart rendering
cd docs && npm run docs:dev
# Navigate to algorithm page, verify charts load

Complexity

High - Data pipeline + ECharts integration + async loading

Labels

visualization, enhancement</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Wire ECharts components to consume real benchmark data Wire ECharts charts to real benchmark JSON data Jan 5, 2026
Copilot AI requested a review from Anselmoo January 5, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart Components: Wire ECharts to Real Benchmark Data

2 participants