Task: Display per-component and combined GMM PDFs

Table of Contents

This page documents a task in the GMM improvements: tidy up synthetic data generation loose ends story. It captures the goal, current status, acceptance, and any notes or results.

Goal

The Live Return Distribution Preview currently does not distinguish individual GMM components from the overall mixture. Render each configured component's own PDF curve, plus the combined/mixture GMM PDF in a distinct colour, so users can see how components contribute to the mixture while tuning parameters.

Status

Field Value
State DONE
Parent story GMM improvements: tidy up synthetic data generation loose ends
Now Done.
Waiting on Nothing.
Next Move to the next task.
Last touched 2026-07-02

Acceptance

  • Each configured GMM component renders its own PDF curve on the Live Return Distribution Preview.
  • The combined mixture PDF renders in a colour visually distinct from the per-component curves.
  • Legend or labelling makes clear which curve is which.

Plan

Added ReturnDistributionChart::componentColor(int index) — a static helper cycling through a 7-colour qualitative palette (coral, amber, mint, violet, lime, pink, grey), deliberately excluding the steel-blue used for the mixture curve. setComponents() now computes each component's weighted contribution (weight × N(x; μ, σ)) alongside the combined sum, normalises both to the mixture's peak, and draws each component's contribution as its own QLineSeries in its colour, drawn on top of the existing filled mixture area.

On the editor side (FxSpotRateEditor), added a new leading "Colour" column (ColColor) to the Advanced-mode component table, with a small 16×16 swatch per row painted via ReturnDistributionChart::componentColor(row) — row index doubles as colour index, matching the chart. Added updateComponentColors() to repaint all swatches after a row is removed, since removal shifts every subsequent row's index (and therefore its colour) down by one; addTableRow already assigns the right colour on insertion (append and full rebuild both add rows in final order).

Notes

PRs

PR Title
   

Review

Comment summary File Decision Notes
       

Result

Each GMM component now renders its own weighted-contribution PDF curve on the Live Return Distribution Preview, coloured to match a new colour swatch on its row in the Advanced-mode component table; the combined mixture stays the existing steel-blue filled area, excluded from the component palette so it is always visually distinct. Colour indices track table row position and are repainted on row removal. Built ores.qt.synthetic.lib clean (clang debug/make).

Emacs 29.3 (Org mode 9.6.15)