Skip to content

Browser UI: a plotter beside the REPL - #112

Merged
bdbarnett merged 1 commit into
mainfrom
repl-plotter
Oct 11, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
repl-plotter

Conversation

@bdbarnett

Copy link
Copy Markdown
Collaborator

Numbers the board prints at the REPL can now be drawn live as a graph. The Plotter button over the REPL opens it beside the terminal (below it on a narrow window).

Each line of output that is only numbers adds one sample: print(t) is one series, print(t, h, p) or print(t, h, p, sep=' ') is three, and print(f"temp:{t} hum:{h}") names them (temp: 21.5 and temp=21.5 work too). Prompts, tracebacks and text with a number in it are left alone. Up to eight series, the newest 500 samples scaled to fit, a legend with each series' latest value, and a crosshair with the values at the hovered sample. Pause stops adding samples, Clear starts over, and the pane remembers whether it was open.

The series colours are one fixed order, with steps chosen for the dark and the light theme and checked for colour-blind separation against each surface. The light theme's yellow, aqua and pink sit under 3:1 against white, so the legend always names each series and gives its value in text.

Checked. ui/src/plotparse.ts has node tests (npm test in ui/, added to CI's ui job): separators, names, rejected lines, colour codes, and lines split across chunks. In headless Chromium against the local server, with 200 lines of sin:…, cos: …, ramp=… pushed as REPL output in split chunks plus a prompt and a traceback: three series plotted with the right latest values, hover showed sample 114's values, light and dark themes drew, the open state survived a reload, the close button closed it, and a 400 px window had no sideways scroll. No page errors.

The Plotter button over the REPL opens a live line graph. Each REPL line
that is only numbers adds a sample, one series per number, separated by
commas, semicolons or spaces, optionally named (temp:21.5, temp: 21.5,
temp=21.5); any other output is left alone. Up to eight series in a fixed
colour order, stepped for the dark and light themes; the newest 500
samples, scaled to fit; hover for the values at a sample; Pause and Clear.
The pane's open state is remembered.

The line parser lives in plotparse.ts with node tests (npm test in ui/,
now run by CI).
@bdbarnett
bdbarnett merged commit f202900 into main Oct 11, 2026
4 checks passed
@bdbarnett
bdbarnett deleted the repl-plotter branch October 11, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant