Repository navigation
Browser UI: a plotter beside the REPL - #112
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)orprint(t, h, p, sep=' ')is three, andprint(f"temp:{t} hum:{h}")names them (temp: 21.5andtemp=21.5work 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.tshas node tests (npm testinui/, 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 ofsin:…, 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.