Chart: keep a coarse layer in memory so a fast pan never shows an empty pane

Open
#75 0 comments 0 reactions 1 assignee View on GitHub

@mrcsin is already working on this.

Since Sep 10, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement

Why

Scroll fast and the pane goes blank, then fills a moment later.

Why it goes blank

Each pen owns exactly one column buffer, and a history load replaces it whole: TrendPenState.LoadHistory builds a list and hands it over in one Line.ReplaceColumns(columns) (Chart/TrendPenState.cs:38-49, Chart/EnvelopeLine.cs:109-115). Rendering culls to the viewport (Chart/EnvelopePath.cs:13-27); pan past the buffer and no column is visible, so Render returns having drawn nothing (Chart/EnvelopeLine.cs:86-90). There is no second buffer and no fallback layer anywhere.

The wait is the debounce plus the read: a 150 ms trailing throttle merged with a 400 ms cap (Chart/TrendChartViewModel.cs:23-24, Chart/ChartHistoryRequestDebouncer.cs:46-65), and the read itself measured at about 0.5 s near the raw ceiling (docs/plans/backlog.md:28-35). Prefetch covers one window width on each side (Chart/HistoryPrefetch.cs:12), so a slow drag never notices and a fast one always does.

Wanted

The fix is already written down in docs/plans/backlog.md:28-35 and this issue adopts it:

  • Keep the Minute layer and coarser in memory for the whole archive extent, read once at startup, one read per layer.
  • Draw the exposed strip from the coarse buffer immediately, then swap the Raw columns in when they land.
  • Widen the Raw margin to several windows, now that the frame no longer pays for buffer width (013f491).

What it costs

A coarse layer is 15 s per point (docs/architecture/data-integration.md:160-165). One year is about two million points per pen; fifty pens make that a hundred million, and at 32 bytes per column it does not fit in memory. So the startup read is bounded by something: a coarser layer for a long extent, or a column budget over the extent rather than a whole layer. #76 produces the numbers this decision needs; the plan should not guess them.

Acceptance

A headless test that pans faster than the debounce and asserts the plottable draws a non-empty path on every frame. Today no test would go red if the pane went blank forever.

Dominant language
C#
Stars
0
Forks
0
Avg merge
18m
Merged PRs (30d)
42

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Semiteq/SemiPlot

All issues in Semiteq/SemiPlot

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.