fix: manual time ticks flood the X axis on long Speed-Run logs (fixed 0.25s/0.05s intervals)

Aperta
#116 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
csharp

Direzione di ricerca

Start with src/CastleOverlayV2/Plot/PlotManager.cs and ApplyManualTimeTicks, then inspect the nearby grid-styling code and GetTimeRange. Implement span-based major and minor intervals while preserving Drag mode’s current 0.25/0.05-second appearance. Verify with a short Drag log and a multi-minute Speed-Run log from Tests/, checking rendering responsiveness, label readability, and hover smoothness.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

PlotManager.ApplyManualTimeTicks generates a fixed-density tick grid: one labeled major every 0.25 s and one minor every 0.05 s across the entire plotted time range. That's perfect for Drag mode's ~3 s window, but Speed-Run mode plots the whole log — a 10,000-row log at 0.05 s/sample spans 500 s, producing ~2,000 labeled majors + 10,000 minors. Every tick is re-rendered on every mouse move (the hover handler calls _plot.Refresh() continuously), so long logs make the UI sluggish and the axis labels unreadably dense.

Root cause

src/CastleOverlayV2/Plot/PlotManager.cs:1208 — ApplyManualTimeTicks:

for (double pos = Math.Ceiling(minX / 0.25) * 0.25; pos <= maxX; pos += 0.25)
    manual.AddMajor(pos, pos.ToString("0.00"));
for (double pos = Math.Ceiling(minX / 0.05) * 0.05; pos <= maxX; pos += 0.05)
    manual.AddMinor(pos);

The 0.25 / 0.05 intervals are hardcoded regardless of span.

Suggested fix

Scale the interval to the span so tick count stays bounded (~10–40 majors). Pick the major interval from a ladder and derive the minor as major / 5:

double span = maxX - minX;
double major =
    span <= 5   ? 0.25 :
    span <= 12  ? 0.5  :
    span <= 30  ? 1.0  :
    span <= 60  ? 5.0  :
    span <= 300 ? 10.0 :
                  30.0;
double minor = major / 5.0;

Then use major/minor in the two loops (format labels with "0.##" so 5 doesn't render as 5.00 unnecessarily — or keep "0.00" if you prefer the current look for short spans).

Constraints:

  • Drag mode must look identical to today: its span is ~3.2 s (−0.5 → +2.5 plus padding), which the ladder above maps to 0.25/0.05 — verify this.
  • Don't switch to ScottPlot's automatic tick generator unless the ladder proves insufficient; the manual generator is used deliberately for the grid styling below it (same method, lines ~1223–1228).
  • The X range used here comes from GetTimeRange — no changes needed there.

Acceptance criteria

  • Drag mode rendering is pixel-identical to current behavior (0.25 s labels, 0.05 s grid).
  • Speed-Run mode with a long log (several minutes) renders promptly and hover/mouse-move stays smooth.
  • Axis labels are legible (no overlapping label text) at any zoom of a long log.
  • Zooming in on a long log still shows sensible ticks (note: ticks are computed from the data span at plot time, not the zoom window — that limitation exists today and is out of scope; just don't make it worse).

Test plan

Manual: load a short drag log (Drag mode) → compare axis to a pre-change screenshot. Switch to Speed-Run mode, load the longest CSV in Tests/ (or duplicate rows in a copy to fake a 5-minute log) → confirm responsiveness while moving the mouse over the plot and readable labels.


Workflow (repo convention): branch from main as fix/adaptive-time-ticks, one logical change per PR, open with gh pr create including a test/verify plan. Do not merge — Stewart merges.

Lingua principale
C#
Stelle
0
Fork
1
Merge medio
6h 35m
PR unite (30g)
46

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stewmac570/DragOverlay

Tutte le issue di stewmac570/DragOverlay

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.